【提问】文字如何转换成GB2312编码?
问下有没有这样的函数(文字转换成GB2312编码形式):
CString str1 = "文字";
CString str2;
str2 = Trans(*******);
最后:str2 = “%ce%c4%d7%d6”;//GB编码
文字转GB2312; CString转换GB2312;
[解决办法]
很明显不是GB2312编码啦
要用到
GB2312的代码页是936
ANSI的,如("文字"),用MultiByteToWideChar(CP_ACP,...);转Unicode,再转GB2312
Unicode的,如(L"文字"),用WideCharToMultiByte(936, ...);
"文字"的GB2312编码是4E44 5756