I'd like to do something like this:
const UniChar KA = 'か';
But XCode spits back "Multi-character constant".
I try to avoid using +characterAtIndex of NSString... I need this to iterate over the kana, like you can iterate over the alphabet (char myCharacter = 'A';
)
I was looking at Objective c doesn't like my unichars? but it doesn't really solve it in a nice way for me.
Anyway, I'm trying to put the "tenten" and/or "maru" on top of か, た, etc like か→が, た→だ. Might be a ready made solution for that, in case anyone knows, that'll solve my problem as well.
Source code is usually encoded as UTF-8, which means you can't use 16-bit character literals there. You need to use the escape sequence:
const UniChar KA = '\u30AB';
or specify the value numerically:
const unichar KA = 0x30AB;
(Note: I really have no idea if that's the correct code for the example character you gave.)
I think your only other option is to create a .strings file, which can and should be UTF-16 encoded, and then get the characters into your program using NSLocalizedString.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With