【发布时间】:2013-09-06 22:58:06
【问题描述】:
我有当前的代码,除了 CFShow 没有将 \u00e9 的 unicode UTF8 编码转换为 é 之外,它似乎确实可以工作
#include <CoreFoundation/CoreFoundation.h>
int main()
{
char *s = "This is a test of unicode support: fiancée\n";
CFTypeRef cfs = CFStringCreateWithCString(NULL, s, kCFStringEncodingUTF8);
CFShow(cfs);
}
输出是
This is a test of unicode support: fianc\u00e9e
|____|
> é doesn't output properly.
我如何指示 CFShow 它是 unicode?当它是一个 c 字符串时,printf 可以很好地处理它。
【问题讨论】:
-
如果
CFShow还不相信字符串是 Unicode,它就不会像这样解释字符并使用\u转义。你会看到像\xC3\xA9这样的东西。
标签: c++ c macos core-foundation