English 中文(简体)
Case fold UTF-8 without knowing the language
原标题:

I m trying to evaluate different strategies for case insensitive UTF-8 string comparison.

I ve read some material from the Unicode consortium, experimented with ICU and tried to come up with various quality-of-implementation alternatives.

On multiple occasions I ve seen texts differ between Simple Case Mapping and Full Case Mapping, and I wanted to make sure I understand the difference entirely.

As I read it, Simple Case Mapping is "context-free", i.e. doesn t need to know what language the payload is. This will give approximate results, due to the Turkic "I/ı/İ/i" debacle.

Full Case Mapping, on the other hand, needs to know the language of the payload to be able to perform the mapping. With that extra information, it can take special measures to cover cases where "Kim" as a Turkic string should become "KİM" in upper-case, but "Kim" as an English string, should become "KIM" in upper-case.

Have I got that right?

Are there other examples of "multi-faceted" code points that fold differently for different languages?

Thanks!

UPDATE: One of the sources mentioning simple case mapping as language independent is ICU s documentation. I interpreted that as Unicode truth, but maybe it s just a statement of the implementation?

最佳回答

No, a "full case mapping" is a casing where one codepoint needs to be replaced by more than one new codepoints. A simple case mapping is a single codepoint substitution.

If you want to implement this yourself then the Unicode CaseFolding.txt file is crucial to get this right. Note the status field code "T", specifically there to handle the Turkish I problem.

问题回答

Well ... The consonant combination "SS" would down-case to "ss" for most Western languages, but in German it might become the special letter "ß". That s just "might", there are quite involved usage rules to consider.

I think this doesn t directly affect collation order (any Germans are of course welcome to correct me) though, so maybe it s a moot point.





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签