Reputation: 111
I have simple question but can't find answer:
NSString *polishLetters = @"ąęćźż";
//How to get NSString *correctString = @"aeczz";
So it's about string coding..How to do this?
Upvotes: 1
Views: 134
Reputation: 539965
NSString *polishLetters = @"ąęćźż";
NSMutableString *correctString = [polishLetters mutableCopy];
CFStringTransform((__bridge CFMutableStringRef)correctString, NULL, kCFStringTransformStripCombiningMarks, NO);
NSLog(@"%@", correctString);
// Output: aeczz
This is not really about "string coding". ą
is Unicode U+0105 (LATIN SMALL LETTER A WITH OGONEK), and the Unicode Data Base
http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt defines the properties of
that character as
0105;LATIN SMALL LETTER A WITH OGONEK;Ll;0;L;0061 0328;;;;N;LATIN SMALL LETTER A OGONEK;;0104;;0104
Field #6 (0061 0328
) is the decomposition into a
(U+0061) and "COMBINING OGONEK" (U+328). The above string transformation removes the combining mark, leaving just a
.
Upvotes: 3