these statements can conver unicode "早"(e9 65) to big5 "早"(a6 ad), u must compile and run it under traditional Chinese edition windows ------------------------------------------------------ WCHAR szUin[]=L"早"; char szBig5[3] = {0}; int nCount = wcslen(szUin); int nSize=0; nSize=WideCharToMultiByte(CP_ACP,0, szUin, nCount, NULL,0,NULL,NULL); WideCharToMultiByte(CP_ACP,0, szUin, nCount, szBig5, nSize,NULL,NULL); MessageBox(szBig5);
try WideCharToMultiByte() to convert UNICODE to GB2312(big5).
a[0]=0xe9;
a[1]=0x65;
a[3]=NULL;
..可以通過WideCharToMultiByte轉換.
或者直接把你的工程編譯為unicode工程.
然後上面的char;
用CString b;
b.Format(_T("%s"),a);
AfxMessageBox(b);//應該可以
非常感谢你,能告诉我怎么将工程编译为UNICODE工程?
------------------------------------------------------
WCHAR szUin[]=L"早";
char szBig5[3] = {0};
int nCount = wcslen(szUin);
int nSize=0;
nSize=WideCharToMultiByte(CP_ACP,0, szUin, nCount, NULL,0,NULL,NULL);
WideCharToMultiByte(CP_ACP,0, szUin, nCount, szBig5, nSize,NULL,NULL);
MessageBox(szBig5);