Have you ever tried to convert text files to UTF-8 using UltraEdit? The conversion function works perfectly, but if the files are PHP (up to version 5) scripts you might encounter an error that is caused by PHP’s limited unicode capabilities (see bugs 22108, 42312 and more).

What’s The Problem?
UltraEdit by default writes a so-called Byte-Order-Marker (BOM) at the beginning of each UTF-8 file it saves. The BOM, which consists of three bytes (FF FE BE specifically), allows older programs to detect unicode encoded files. PHP however does not recognize the BOM and passes these three bytes directly to the output. In many cases this is no problem, as most browsers are capable of handling it. But if you want to send HTTP headers from that PHP file – e.g. by a session_start() – they will fail, because “output has already started”. Furthermore I noticed a strange behaviour with IE 6 that did not recognize the BOM and interpreted it as (non-printable) data before the DOCTYPE – which is invalid XHTML and caused IE to render my page wrong. Note that this error was also detected by the W3C XHTML validator, thus it is obviously not a bug in IE, but FF is maybe just a bit more relaxed.

OK, What Can I Do?
Starting from version 10.10a it is possible to disable the writing of BOMs by UltraEdit. To do that one has to alter its configuration file (usually at C:\Windows\UEdit32.ini) manually. In the section [Settings] add the following lines:

Write UTF-8 BOM=0
Write UTF-8 BOM NF=0

(The first line disables writing of the BOM for edited files while the second one disables it for new files.)

These two lines did the job for me and I am happier than ever with UltraEdit now.

I found this tip at Vladimir’s homepage.