xcode UTF-8 literals

后端 未结 4 2052
难免孤独
难免孤独 2020-12-03 11:02

Suppose I have the MUSICAL SYMBOL G CLEF symbol: **

4条回答
  •  被撕碎了的回忆
    2020-12-03 11:23

    1. I would prefer the way you did it in uni3, but sadly that is not recommended. Failing that, I would prefer the method in uni to that in uni2. Another option would be [NSString stringWithFormat:@"%C", 0x1d11e].
    2. It is a "universal character name", introduced in C99 (section 6.4.3) and imported into Objective-C as of OS X 10.5. Technically this doesn't have to give you UTF-8 (it's up to the compiler), but in practice UTF-8 is probably what you'll get.
    3. The encoding of the source code file is probably UTF-8, matching what the runtime expects, so everything happens to work. It's also possible the source file is UTF-16 or UTF-32 and the compiler is doing the Right Thing when compiling it. None the less, Apple does not recommend this.

提交回复
热议问题