//---------------------------------------------------------------------------- // GB2312 => GBK void GB2GBK(char *szBuf) { if(!strcmp(szBuf, "")) return; int nStrLen = strlen(szBuf); WORD wLCID = MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_CHINESE_PRC); int nReturn = LCMapString(wLCID, LCMAP_TRADITIONAL_CHINESE, szBuf, nStrLen, NULL, 0); if(!nReturn) return; char *pcBuf = new char[nReturn + 1]; __try { wLCID = MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_CHINESE_PRC); LCMapString(wLCID, LCMAP_TRADITIONAL_CHINESE, szBuf, nReturn, pcBuf, nReturn + 1); strncpy(szBuf, pcBuf, nReturn); } __finally { delete[] pcBuf; } } //---------------------------------------------------------------------------
|
正在阅读:三种常见中文内码的转换方法三种常见中文内码的转换方法
2006-11-10 09:23
出处:
责任编辑:lizhe
键盘也能翻页,试试“← →”键