Page 1 of 3
[Fixed] Content Search - not work with some characters in ..
Posted: 08 Apr 2016 19:12
by Nolan
XY: fresh v16.50.0205
Mode: Normal
Type: Text
Match unicode: Yes
It seems some (not all) Traditional Chinese characters e.g. 虎 牛 狗 in an UTF-8 encoded txt file can't be identified by XY's Content Search. Performing a Content Search with any of those characters will not make the txt file appear in search result.
(If those characters exist In a Big5 encoded txt file, the Content Search works well w/o ticking "Match unicode".)
Re: Content Search - not work with some characters in UTF-8
Posted: 08 Apr 2016 20:32
by admin
Untick "Match unicode".
Re: Content Search - not work with some characters in UTF-8
Posted: 08 Apr 2016 22:03
by Nolan
Content Search doesn't work with 虎 / 牛 / 狗 that exists in UTF-8 encoded txt files. However, at least it works with some other Traditional Chinese characters e.g. 貓 馬 鷹 in UTF-8 txt files if "Match unicode" is ticked.
Unticking "Match Unicode", and then performing a Content Search with any of 虎 牛 狗 貓 馬 鷹, will make any UTF-8 txt files containing the character not show up in search result.
Re: Content Search - not work with some characters in UTF-8
Posted: 08 Apr 2016 22:07
by oXYgen
I've created files with identical content "sample text" in different encodings (little-endian). Trying to search in "Normal" mode:
- without "Match unicode"
found: ASCII, UTF-8 (-BOM), UTF-8 (+BOM), UTF-16 (+BOM)
not found: UTF-16 (-BOM), UTF-32 (-BOM), UTF-32 (+BOM)
- with "Match unicode"
found: UTF-16 (-BOM), UTF-32 (+BOM)
not found: ASCII, UTF-8 (-BOM), UTF-32 (-BOM), UTF-8 (+BOM), UTF-16 (+BOM)
User guide states that a text string "Text" will match with "T0e0x0t0". Why it finds UTF-32 and skips UTF-16 when "Match unicode" is checked? Why it finds UTF-8 and UTF-16 when "Match unicode" is unchecked? Why presence of byte order mark (BOM) affects the results? I'm really confused
Could you explain how "Match unicode" checkbox works?
Re: Content Search - not work with some characters in UTF-8
Posted: 09 Apr 2016 10:44
by admin
Nolan wrote:Content Search doesn't work with 虎 / 牛 / 狗 that exists in UTF-8 encoded txt files. However, at least it works with some other Traditional Chinese characters e.g. 貓 馬 鷹 in UTF-8 txt files if "Match unicode" is ticked.
Unticking "Match Unicode", and then performing a Content Search with any of 虎 牛 狗 貓 馬 鷹, will make any UTF-8 txt files containing the character not show up in search result.
Works fine here. The only explanation would be that you are using BOM-less UTF-8 files AND you unticked "Configuration | Preview | Text preview | UTF-8 auto-detection".
Re: Content Search - not work with some characters in UTF-8
Posted: 09 Apr 2016 10:56
by admin
oXYgen wrote:I've created files with identical content "sample text" in different encodings (little-endian). Trying to search in "Normal" mode:
- without "Match unicode"
found: ASCII, UTF-8 (-BOM), UTF-8 (+BOM), UTF-16 (+BOM)
not found: UTF-16 (-BOM), UTF-32 (-BOM), UTF-32 (+BOM)
- with "Match unicode"
found: UTF-16 (-BOM), UTF-32 (+BOM)
not found: ASCII, UTF-8 (-BOM), UTF-32 (-BOM), UTF-8 (+BOM), UTF-16 (+BOM)
User guide states that a text string "Text" will match with "T0e0x0t0". Why it finds UTF-32 and skips UTF-16 when "Match unicode" is checked? Why it finds UTF-8 and UTF-16 when "Match unicode" is unchecked? Why presence of byte order mark (BOM) affects the results? I'm really confused
Could you explain how "Match unicode" checkbox works?
What string did you search?
BTW, UTF-32 is not supported in XY.
PS: "Match unicode" should probably be removed from the UI. It's not very useful and confusing without explanation.
Re: Content Search - not work with some characters in UTF-8
Posted: 09 Apr 2016 14:57
by oXYgen
admin wrote:What string did you search?
I search "sample text" or just "text". It makes no difference
admin wrote:BTW, UTF-32 is not supported in XY.
Why it finds UTF-32 (+BOM) that is actually "t000e000x000t000"? Why it finds UTF-16 (-BOM) but skips UTF-16 (+BOM)? The difference is 2 first bytes "FF FE" in UTF-16 (+BOM).
admin wrote:"Match unicode" should probably be removed from the UI.
What if you include several checkboxes for encodings in a separate dialog box and replace "Match unicode" checkbox with "Encodings..." button?
Re: Content Search - not work with some characters in UTF-8
Posted: 09 Apr 2016 15:53
by admin
1) Let's forget about "Match unicode". I will probably remove it. It's not necessary for most users.
2) All other searches work well as advertised. (As I said UTF-32 is not supported)
Re: Content Search - not work with some characters in UTF-8
Posted: 09 Apr 2016 17:03
by oXYgen
admin wrote:I will probably remove it.
UTF-16 (-BOM) is not found if "Match unicode" has not been checked. Are you about to combine both search results (with and without "Match unicode")?
Re: Content Search - not work with some characters in UTF-8
Posted: 09 Apr 2016 17:10
by admin
oXYgen wrote:UTF-16 (-BOM) is not found if "Match unicode" has not been checked.
UTF-16 without BOM is also not supported. I forgot to mention that. (Never met such a file in real life.)
That it works in this case with "Match unicode" checked is just a coincidence. It would not work for Chinese characters.
Re: Content Search - not work with some characters in UTF-8
Posted: 09 Apr 2016 17:27
by oXYgen
admin wrote:(As I said UTF-32 is not supported)
admin wrote:UTF-16 without BOM is also not supported. I forgot to mention that.
Please add this information to the User guide

Re: Content Search - not work with some characters in UTF-8
Posted: 10 Apr 2016 06:43
by Nolan
I use a fresh XY to test the problem. By default, "UTF-8 auto-detection" is
on, and I never change it.
UTF-8_auto-detection_ON.png
For the test, I created 2 .txt files:
test_Big5.txt and
test_UTF-8.txt, and put them in the same folder:
TEST.
test_Big5.txt is BIg5 encoded, and
test_UTF-8.txt is UTF-8 encoded with BOM. Both .txt files have the same text content:
貓 馬 鷹
虎 牛 狗
XY's Preview shows the text content and decoding of each .txt file:
the text content and decoding of
test_Big5.txt
Big5_txt_content.png
the text content and decoding of
test_UTF-8.txt
UTF-8_with_BOM_txt_content.png
Search result of a Content Search:
貓 In folder: TEST when "Match unicode" is
OFF:
find_貓_matchunicode_OFF.png
Search result of a Content Search:
貓 In folder: TEST when "Match unicode" is
ON :
find_貓_matchunicode_ON.png
Search result of a Content Search:
虎 In folder: TEST when "Match unicode" is
OFF :
find_虎_matchunicode_OFF.png
Search result of a Content Search:
虎 In folder: TEST when "Match unicode" is
ON :
find_虎_matchunicode_ON.png
Re: Content Search - not work with some characters in UTF-8
Posted: 10 Apr 2016 10:40
by admin
OK, I see, and I could reproduce it.
The problem here is that Big5 has no BOM, and there is no safe way to detect a Big5 (or any other BOM-less) encoding by scanning the byte patterns. So you would have to tell XY the encoding of the file. This is currently not possible in content search.
Now in your case Big5 appears to be the system default so I would have expected that it works out of the box. I will check this now...
... well, it's complex and hard to debug. I have to switch back and forth between German and Chinese regional settings all the time, and need to compile the app for testing each time since the source code is garbled under Chinese regional settings. I finally thought I had it but for reasons I don't understand it failed. I'm currently out of ideas. Nevertheless I upload the beta version. Maybe it works at your end.
Re: Content Search - not work with some characters in UTF-8
Posted: 10 Apr 2016 16:04
by oXYgen
admin wrote:Renamed "Match unicode" to "Match wide strings". More correct, less confusing.
Could you explain what it is used for? Example? I've searched the forum but found nothing related to practical usage of this feature

Re: Content Search - not work with some characters in UTF-8
Posted: 10 Apr 2016 16:08
by admin
The tooltip explains it.