CEncode.h文件
 1 #ifndef _CENCODE_H_
 2 #define _CENCODE_H_
 3 
 4 #include <iostream>
 5 #include <string>
 6 #include <windows.h>
 7 using namespace std;
 8 
 9 class CEncode
10 {
11 public:
12     //Converting a WChar string to a Ansi string
13     static    std::string WChar2Ansi(LPCWSTR pwszSrc);
14 
15     //Converting a Ansi string to WChar string
16     static std::wstring Ansi2WChar(LPCSTR pszSrc, int nLen);
17 
18     //Unicode to ANSI
19     static std::string UnicodeToANSI(const wstring& wstr);
20 
21     // Unicode to UTF-8
22     static std::string UnicodeToUTF8( const wstring& wstr );
23 
24     // ANSI to Unicode
25     static std::wstring ANSIToUnicode( const string& str );
26 
27     //UTF-8 to Unicode
28     static std::wstring UTF8ToUnicode(const string& inUtf8);
29 
30     //GBK to UTF-8
31     static std::string GBKToUTF8(const std::string& strGBK);
32 
33     //UTF-8 to GBK
34     static std::string UTF8ToGBK(const std::string& strUTF8);
35 
36     //UTF-8 to GB2312
37     static std::string UTF8ToGB2312(const char* utf8);
38 
39     //GB2312 to UTF-8
40     static std::string GB2312ToUTF8(const char* gb2312);
41 
42 };
43 #endif
View Code

相关文章:

  • 2021-10-06
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
  • 2021-07-28
  • 2022-01-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案