I scratch my head over it.
I want to combine two Korean characters into one.
ㅁ + ㅏ = 마
How do I do this using NSString?
Edit:
zaph solution works with two characters. But I do not understand how to combine more than two.
ㅁ + ㅏ + ㄴ = 만
But
NSString *s = @"ㅁㅏㄴ";
NSString *t = [s precomposedStringWithCompatibilityMapping];
NSLog(@"%@", t);
displays
마ㄴ
Edit 2:
I looked around a bit and seemed a little busy. A character like "만" consists of 3 parts. Initial Jamo, Medial Jamo and Final Jamo. They must be combined to match the code point in the Khangul syllables using the equation below.
((initial * 588) + (medial * 28) + final) + 44032
This blog post has a very good explanation.
mkwon source
share