gpt4 book ai didi

c++ - linux g++ 的 Unicode 问题

转载 作者:行者123 更新时间:2023-11-30 00:59:35 25 4
gpt4 key购买 nike

我的 Ubuntu 10.10 linux 下的 unicode 函数有问题。许多 unicode 函数无法正常工作。当我尝试遵循简单的代码时:

#include <wchar.h>

int main(int argc, char *argv[])
{
wprintf(L"test %s %s %s\n",L"one",L"two",L"three");
return 0;
}

并使用g++(gcc版本4.4.5 Ubuntu/Linaro 4.4.4.-14ubuntu5)编译得到如下结果:

test o t t

而不是预期的:

test one two three

此外,其他用于处理 unicode 字符串的函数也无法正常工作。我的很多代码都是在 MS Windows 下开发的,这是我第一次尝试 linux 编程。

(同样的错误出现在我测试这个片段的两台 linux 机器上)

感谢您的任何建议。

最佳答案

您需要 %ls,如 wprintf(3) 手册页中所述。

关于c++ - linux g++ 的 Unicode 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4107571/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com