Page 1 of 1

Content search in UTF-8 and UTF-16 files without BOM (Byte-order-mark, Signature) doesn't work

Posted: 18 Dec 2017 14:29
by medder
For years I'm having problems with Content search in XYPlorer and Russian language.

I've installed the latest version of XYplorer 18.60 and looked through the long changelog,

A year ago there were the following changes:

Code: Select all

v16.90.0209 - 2016-06-14 12:25
Content Search: Did not work for UTF-8 or UTF-16 encoded files of unknown types. Fixed.
Content Search: Did not work for UTF-16BE encoded files. Fixed.
After reading these lines I double-checked my test TXT-files,
containing two words: "test" and "тест" (in Russian), saved in Notepad2, using different encoding.

Here's the list of test cases:
1 - ANSI (Ciryllic Windows-1251)
2 - UTF-8
3 - UTF-8 BOM
4 - UTF-16 LE
5 - UTF-16 BE
6 - UTF-16 LE BOM
7 - UTF-16 BE BOM
encoding.zip
These files can be correctly opened in any modern text editor (Notepad2, Brackets, Sublime Text, etc) with the word "тест" displayed as is.

Unfortunately XYPlorer was unable to find the word "тест" in any UTF-encoded file saved without UTF Signature (Bite-order-mark). There would be no problem if i needed to search the files created on my PC (I can save all the files in UTF-8 BOM), but the most common encoding is plain unsigned UTF-8. Most of Unicode HTML-files in the internet are saved in UTF-8 (without BOM), most of the TXT files, that somehow appear on my PC are encoded in UTF-8 without Signature (BOM).

And XYplorer doesn't give me any possibility to look for these files on my computer using content search.

Back to the test.

Searching for the English word "test" in "Text" mode gives me:
1 - ANSI (Ciryllic Windows-1251)
2 - UTF-8
3 - UTF-8 BOM
6 - UTF-16 LE BOM
7 - UTF-16 BE BOM

Searching for the English word "test" in "Text and binary" mode gives me:
1 - ANSI (Ciryllic Windows-1251)
2 - UTF-8
3 - UTF-8 BOM
6 - UTF-16 LE BOM

Searching for the Russian word "тест" in "Text" mode gives me:
1 - ANSI (Ciryllic Windows-1251)
3 - UTF-8 BOM
6 - UTF-16 LE BOM
7 - UTF-16 BE BOM

Searching for the Russian word "тест" in "Text and binary" mode gives me:
1 - ANSI (Ciryllic Windows-1251)
3 - UTF-8 BOM
6 - UTF-16 LE BOM

I work with web-sites and the most common encoding is UTF-8 (without signature),
UTF-8 BOM can cause issues and cannot be used for all cases.

So it is very disappointing that I cannot find any Russian character in the files encoded in UTF-8 using XYplorer.


PS. Windows 7 x64 Russian, default encoding: Windows-1251

BTW, XYPlorer also previews some of these files incorrectly:
1 - ANSI (1251) - decoded as "System Default (1251)" - displayed correctly
2 - UTF-8 - decoded as "System Default (1251)" - displayed incorrectly
3 - UTF-8 BOM - decoded as "UTF-8 BOM" - displayed correctly
4 - UTF-16 LE - decoded as "System Default (1251)" - displayed incorrectly
5 - UTF-16 BE - decoded as "System Default (1251)" - displayed incorrectly
6 - UTF-16 LE BOM - decoded as "UTF-16LE" - displayed correctly
7 - UTF-16 BE BOM - decoded as "UTF-16BE" - displayed correctly

Re: Content search in UTF-8 and UTF-16 files without BOM (Byte-order-mark, Signature) doesn't work

Posted: 18 Dec 2017 14:38
by highend
THANKS! Because of what? Because you've created a wonderful bug report.
Details, test cases, clear, precise language.

Configuration | Preview | Preview | Text preview | UTF-8 auto-detection

Check the setting and at least your problem with not finding "тест" in
UTF-8 without BOM should be gone (which seems to be your most important point)

Re: Content search in UTF-8 and UTF-16 files without BOM (Byte-order-mark, Signature) doesn't work

Posted: 18 Dec 2017 14:50
by medder
Oh, I'm an idiot!

Code: Select all

UTF-8 without BOM should be gone (which seems to be your most important point)
You are right, that was my main problem. And the setting helped.

XYplorer failed to find the files saved in UTF-16 without BOM (using Text mode)
and the file in "UTF-16 BE BOM" (using "Text and Binary" mode), but they are far less common.

Thank you very much!

You can delete this bug-report... or leave it for other dummies like me,
who will be first to post on forum instead of searching through Settings for "UTF".




I have one question though. What was the reason for adding this setting (and not making this the default behavior)?
Can this "UTF-8 auto-detection" cause some other issues or make the content search more slow?

Re: Content search in UTF-8 and UTF-16 files without BOM (Byte-order-mark, Signature) doesn't work

Posted: 18 Dec 2017 15:23
by admin
UTF-8 auto-detection is enabled by default. And yes, it slightly slows down opening text files. So if you never use BOM-less UTF-8 files, you should turn it off.


UTF-16 without BOM is not supported by XY.