Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

objective c - iOS CFStringTransform and ?

I'm working on an iOS app in which I have to list and sort people names. I've some problem with special character.

I need some clarification on Martin R answer on https://stackoverflow.com/a/15154823/2148377

You could use the CoreFoundation CFStringTransform function which does almost all transformations from your list. Only "?" and "?" have to be handled separately:

Why this particular letter? Where does this come from? Where can I find the documentation?

Thanks a lot.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I am not 100% sure, but I think it can be seen from the Unicode Data Base http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt.

For example, the entry for "à" is

00E0;LATIN SMALL LETTER A WITH GRAVE;Ll;0;L;0061 0300;;;;N;LATIN SMALL LETTER A GRAVE;;00C0;;00C0

where field #6 is the "Decomposition mapping" into "a" + U+0300 (COMBINING GRAVE ACCENT), therefore

CFStringTransform(..., kCFStringTransformStripCombiningMarks, ...)

transforms "à" into "a".

The entries for "?" and "?" are

0110;LATIN CAPITAL LETTER D WITH STROKE;Lu;0;L;;;;;N;LATIN CAPITAL LETTER D BAR;;;0111;
0111;LATIN SMALL LETTER D WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER D BAR;;0110;;0110

where field #6 is empty, so these characters do not have a decomposition into a "base character" and a "combining mark".

So the question remains: Which standard determines that a "normalized form" of "? / ?" is "d / D"?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...