views:

154

answers:

1

How can I define russian strings in 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.

+1  A: 

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").

McDowell