This commit is contained in:
xiongziliang 2017-10-10 00:11:58 +08:00
parent fa39514e52
commit c0d6765662

View File

@ -35,14 +35,14 @@ namespace ZL {
namespace Http { namespace Http {
//////////////////////////通用/////////////////////// //////////////////////////通用///////////////////////
void UTF8ToUnicode(WCHAR* pOut, const char *pText) void UTF8ToUnicode(wchar_t* pOut, const char *pText)
{ {
char* uchar = (char *)pOut; char* uchar = (char *)pOut;
uchar[1] = ((pText[0] & 0x0F) << 4) + ((pText[1] >> 2) & 0x0F); uchar[1] = ((pText[0] & 0x0F) << 4) + ((pText[1] >> 2) & 0x0F);
uchar[0] = ((pText[1] & 0x03) << 6) + (pText[2] & 0x3F); uchar[0] = ((pText[1] & 0x03) << 6) + (pText[2] & 0x3F);
return; return;
} }
void UnicodeToUTF8(char* pOut, const WCHAR* pText) void UnicodeToUTF8(char* pOut, const wchar_t* pText)
{ {
// 注意 WCHAR高低字的顺序,低字节在前,高字节在后 // 注意 WCHAR高低字的顺序,低字节在前,高字节在后
const char* pchar = (const char *)pText; const char* pchar = (const char *)pText;