Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我没有看到任何将 UTF8 转换为 Unicode 字符串的直接 NSString 函数?我是否需要使用第三方代码进行转换?
有任何想法吗?
它很容易。首先你得到字符串的长度,[str length],然后你得到一个指向 unichar 字节的指针(unichar 或多或少是 UTF-16):
unichar unibuffer[length]; [str getCharacters:unibuffer range:NSRangeMake(0, length]];