20 lines
624 B
C
20 lines
624 B
C
|
#pragma once
|
||
|
|
||
|
#include <string>
|
||
|
|
||
|
typedef enum
|
||
|
{
|
||
|
GBK,
|
||
|
UTF8,
|
||
|
UNKOWN
|
||
|
} CODING;
|
||
|
|
||
|
int preNUm(unsigned char byte);
|
||
|
bool isUtf8(unsigned char* data, int len);
|
||
|
bool isGBK(unsigned char* data, int len);
|
||
|
CODING GetCoding(unsigned char* data, int len);
|
||
|
int code_convert(const char* from_charset, const char* to_charset, char* inbuf, size_t inlen, char* outbuf, size_t outlen);
|
||
|
int u2g(char* inbuf, size_t inlen, char* outbuf, size_t outlen);
|
||
|
int g2u(char* inbuf, size_t inlen, char* outbuf, size_t outlen);
|
||
|
bool GBKToUTF8(const std::string& strGBK, std::string& str_result);
|
||
|
bool UTFtoGBK(const char* utf8, std::string& str_result);
|