////////////////////////////////////////////////////////////////////////////// //文件 ChineseCode.h //主要功能: // 汉字GB2312与UTF-8编码互转 // //程序编写: 2006-3-08 ///////////////////////////////////////////////////////////////////////////// #if !defined(__CCHINESECODELIB_H_) #define __CCHINESECODELIB_H_ class AFX_EXT_CLASS CChineseCode { public: CChineseCode(); virtual ~CChineseCode(); static CString UTF_8ToGB2312(char *pText, int pLen); static CString GB2312ToUTF_8(char *pText, int pLen); static void UnicodeToUTF_8(char* pOut,WCHAR* pText); // Unicode 转换成UTF-8 static void UTF_8ToUnicode(WCHAR* pOut,char* pText); // 把UTF-8转换成Unicode static void Gb2312ToUnicode(WCHAR* pOut,char *gbBuffer); // GB2312 转换成 Unicode static void UnicodeToGB2312(char* pOut,unsigned short uData); // 把Unicode 转换成 GB2312 static CStringW UTF8toUTF16(const CStringA& utf8); static CStringA UTF16toUTF8(const CStringW& utf16); }; #endif // !defined(__CCHINESECODELIB_H_)