linux g ++的Unicode问题

Lud*_*cka 1 c++ unicode gcc

我的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;
}
Run Code Online (Sandbox Code Playgroud)

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

test o t t
Run Code Online (Sandbox Code Playgroud)

而不是预期的:

test one two three
Run Code Online (Sandbox Code Playgroud)

使用unicode字符串的其他函数也无法正常工作.我在MS Windows下开发的很多代码,这是我的第一个linux编程尝试.

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

谢谢你的任何建议.

Ign*_*ams 6

%ls相反,您需要在wprintf(3)手册页中给出.