开发者

Intel C Compiler and L"" prefix

How can I define russian strings in 开发者_JS百科Intel C Compiler? In MSVS 2008 I do so:

_wsetlocale(LC_ALL, L"Russian");
wprintf(L"текст");

And it works. In ICC in doesn't work.


To diagnose the problem, I'd check to see what values those characters are getting encoded as during compilation. With some code like:

wchar_t *x = L"текст";
for(int i=0; x[i] != L'\0'; i++)
{
  printf("%02x\n", x[i]);
}

You may want to change that "%02x" to "%04x" if sizeof(wchar_t) == 4.

If the values are different, it is probably a compile-time problem where the compilers are using different encodings to interpret the source files.

I would avoid using code points >U+007F in source files, externalize strings to resource files and load them using an appropriate encoding. If you wish, you can try using Unicode escape sequences (like L"\u0442\u0435\u043a\u0441\u0442").

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜