最初的GB2312(GB0)只提供了基本的字符集,它里头是不包含繁体的,后来出了一个商业标准GBK,据英文资料说这是M$制定的(真丢脸,中文标准还外国人制定,但愿这是错误的说法),它与GB2312兼容,收集了大致3倍于GB2312的字符,它就含有繁体,M$对本地化语言提供了支持,示例代码如下: CString src="中华人民共和国"; CString dst; int len=src.GetLength(); LPTSTR lpdst=dst.GetBufferSetLength(len); int b=LCMapString( \ MAKELCID(MAKELANGID(LANG_CHINESE,LCMAP_TRADITIONAL_CHINESE), SORT_CHINESE_PRC), LCMAP_SIMPLIFIED_CHINESE,src,len,lpdst,len); lpst.ReleaseBuffer(); if(b==0);//转换失败
LCMapString The LCMapString function maps one character string to another, performing a specified locale-dependent transformation. The function can also be used to generate a sort key for the input string.int LCMapString( LCID Locale, // locale identifier DWORD dwMapFlags, // mapping transformation type LPCTSTR lpSrcStr, // source string int cchSrc, // number of characters in source string LPTSTR lpDestStr, // destination buffer int cchDest // size of destination buffer );
CString src="中华人民共和国";
CString dst;
int len=src.GetLength();
LPTSTR lpdst=dst.GetBufferSetLength(len);
int b=LCMapString( \
MAKELCID(MAKELANGID(LANG_CHINESE,LCMAP_TRADITIONAL_CHINESE),
SORT_CHINESE_PRC),
LCMAP_SIMPLIFIED_CHINESE,src,len,lpdst,len);
lpst.ReleaseBuffer();
if(b==0);//转换失败
The LCMapString function maps one character string to another, performing a specified locale-dependent transformation. The function can also be used to generate a sort key for the input string.int LCMapString(
LCID Locale, // locale identifier
DWORD dwMapFlags, // mapping transformation type
LPCTSTR lpSrcStr, // source string
int cchSrc, // number of characters in source string
LPTSTR lpDestStr, // destination buffer
int cchDest // size of destination buffer
);