-
Notifications
You must be signed in to change notification settings - Fork 9
/
cxencoding.h
33 lines (19 loc) · 916 Bytes
/
cxencoding.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef CXENCODING_H
#define CXENCODING_H
#include "cxglobal.h"
class GM_CCXX_CORE_API CxEncoding
{
public:
static std::string gb2312ToUtf8(const std::string& sSource);
static std::string utf8ToGb2312(const std::string& sSource);
static std::vector<std::string> gb2312ToUtf8(const std::vector<std::string>& sSources);
static std::vector<std::string> utf8ToGb2312(const std::vector<std::string>& sSources);
static std::string base64Encode(const unsigned char* str, int length);
static std::string base64Decode(const unsigned char* str, int length);
static std::string base64Encode(const std::string& sSource);
static std::string base64Decode(const std::string& sSource);
static bool hasChinese(const std::string& sSource);
static bool isUtf8(const void* pBuffer, long size);
static bool isValidUtf8(unsigned char* s, size_t length);
};
#endif // CXENCODING_H