About Search Problem

I use Opus to search the containing text of the utf8 format file

The english character is OK,but when i use it to search chinese character problem appears,Opus can find nothing.

the attach file is my search file(vs_rank.php)
vs_rank.rar (132 Bytes)


That file is missing the UTF8 BOM at the start of the file.

If you load it into Notepad and then re-save it as either UTF8 or UTF16 then Opus will find it, since Notepad writes the BOM.

Without the BOM the file's type is ambiguous and programs have to guess/assume which encoding is used. Sometimes they'll guess/assume incorrectly.

but the emeditor(CTRL+SHIFT+F) can search the character
out with the same file

EmEditor probably assumes UTF8 when there is no BOM, then. Or maybe it looks at the file and tries to guess the format (like Notepad does). Neither of those things are 100% reliable and it's not a good idea to depend on them.

Forcing programs to guess the encoding, due to there being no BOM, can go wrong. Here's a famous example: en.wikipedia.org/wiki/Bush_hid_the_facts

If you open the file in the Opus viewer (or text-file thumbnails) then you'll see what's happening. The first file is the original and the second and third are the result of loading that into Notepad and then re-saving it as UTF8 and UTF16:





Actually, adding a BOM to a UTF8 PHP file may not be a good idea, which means you can't really win here (unless PHP can accept UTF16 which it probably can't):

From: en.wikipedia.org/wiki/Byte_Order_Mark

(Assuming that is still current and the makers of PHP haven't fixed the problem.)

thanks

but there are lots of files like this ,i unable to re-saving the files all,is that any good way to do the Conversion