Suppose I have the MUSICAL SYMBOL G CLEF
symbol: ** ?? ** that I wish to have in a string literal in my Objective-C source file.
The OS X Character Viewer says that the CLEF is UTF8 F0 9D 84 9E
and Unicode 1D11E(D834+DD1E)
in their terms.
After some futzing around, and using the ICU UNICODE Demonstration Page, I did get the following code to work:
NSString *uni=@"U0001d11e";
NSString *uni2=[[NSString alloc] initWithUTF8String:"xF0x9Dx84x9E"];
NSString *uni3=@"??";
NSLog(@"unicode: %@ and %@ and %@",uni, uni2, uni3);
My questions:
- Is it possible to streamline the way I am doing UTF-8 literals? That seems kludgy to me.
- Is the
@"U0001d11e
part UTF-32? - Why does cutting and pasting the CLEF from Character Viewer actually work? I thought Objective-C files had to be UTF-8?