#ifndef __STRING_PROCESS_20151214__ #define __STRING_PROCESS_20151214__ #pragma once #include #include using namespace std; namespace StringProcess { ////////////////////////////////////////////////////////////////////////// // 将utf8字符串转为unicode字符串; extern WCHAR* utf8_to_unicode(IN const CHAR* pszutf8); extern INT utf8_to_unicode(IN const CHAR *pszutf8, OUT WCHAR *pszunicode); // 将utf8字符串转为ascii字符串; extern CHAR* utf8_to_ascii(IN const CHAR *pszutf8); extern int utf8_to_ascii(IN const CHAR *pszutf8,OUT CHAR* pszacsii); // 将unicode字符串转为acsii(gb312)字符串; extern CHAR* unicode_to_ascii(IN const WCHAR *pszunicode); extern int unicode_to_ascii(IN const WCHAR *pszunicode, OUT CHAR *pszacsii); // 将unicode字符串转为utf8字符串; extern CHAR* unicode_to_uft8(IN const WCHAR *pszunicode); extern int unicode_to_uft8(IN const WCHAR *pszunicode,OUT CHAR* pszutf8); // 将ascii字符串转为unicode字符串; extern WCHAR* ascii_to_unicode(IN const CHAR* pszascii); extern int ascii_to_unicode(IN const CHAR* pszascii,OUT WCHAR *pszunicode); // 将ascii字符串转为utf8字符串; extern CHAR* ascii_to_utf8(IN const CHAR* pszascii); extern int ascii_to_utf8(IN const CHAR* pszascii, OUT CHAR* pszutf8); // http使用; extern void UTF_8ToGB2312(string &pOut, char *pText, int pLen);//utf_8转为gb2312 extern void GB2312ToUTF_8(string& pOut, char *pText, int pLen); //gb2312 转utf_8 extern string UrlGB2312(char * str); //urlgb2312编码 extern string UrlUTF8(char * str); //urlutf8 编码 extern string UrlUTF8Decode(string str); //urlutf8解码 extern string UrlGB2312Decode(string str); //urlgb2312解码 // 下6函数为上6函数的私有函数; extern void Gb2312ToUnicode(WCHAR* pOut, char *gbBuffer); extern void UTF_8ToUnicode(WCHAR* pOut, char *pText); extern void UnicodeToUTF_8(char* pOut, WCHAR* pText); extern void UnicodeToGB2312(char* pOut, WCHAR uData); extern char CharToInt(char ch); extern char StrToBin(char *str); }; #endif