Scene:
1. Thought vs Set source file UTF8 encoding, the code string China appears in it must be UTF8 encoded. Unfortunately no, suppose source code appears in Chinese string, in memory bus code ANSI code.
Unicode (UTF8) code page (65001). Advanced Save Options settings from menu, file.
Examples:
Char path[] = "resources\\ chinese \ \"; for (int i = 0; i < strlen (path); ++i) {printf ("0x%x," (unsigned char) path[i]);}
View UTF8 file Hex 0x72,0x65,0x73,0x6f,0x75,0x72,0x63,0x65,0x73,0x5c,0x5c,0xe4,0xb8,0xad,0xe6,0x96,0x87,0x5c, 0X5C print out the memory: 0x72,0x65,0x73,0x6f,0x75,0x72,0x63,0x65,0x73,0x5c,0xd6,0xd0,0xce,0xc4,0x5c obvious "Chinese" file encoding is 0XE4,0XB8, 0xad,0xe6,0x96,0x87 the memory is loaded and becomes, the encoding is ANSI-encoded, which is the local code (GB2312). 0xd6,0xd0,0xce,0xc4 conclusion is: Do not appear in the source code of the UTF8 Chinese string, It will be code converted to ANSI encoding.
Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.
[c/c++]_[vs2010 Use source code UTF8 Chinese string transcoding ANSI problem]