http://auto.search.msn.com/response.asp?MT=%E4%BB%80%E4%B9%88&srch=5&prov=&utf8
9 个解决方案
#1
那个应该是加过密的吧
#2
通过MultiByteToWideChar()/WideCharToMultiByte()在UTF-8与Unicode字符串间进行转换,Code page用CP_UTF8
UTF8 is a code page that uses a string of bytes to represent a 16-bit Unicode string where ASCII text (<=U+007F) remains unchanged as a single byte, U+0080-07FF (including Latin, Greek, Cyrillic, Hebrew, and Arabic) is converted to a 2-byte sequence, and U+0800-FFFF (Chinese, Japanese, Korean, and others) becomes a 3-byte sequence.
The advantage is that most ASCII text remains unchanged and almost all editors can read it.
Windows NT4.0 supports Unicode<->UTF8 translation via MultiByteToWideChar()/WideCharToMultiByte(), using CP_UTF8 for the CodePage parameter, but it only works when none of the flags are set for dwFlags (therefore, you need to specify 0 for dwFlags).
Also, UTF8 is not a valid encoding for command line arguments for Windows NT 4.0 or 5.0, and it is not supported on Windows 95.
UTF8 is a code page that uses a string of bytes to represent a 16-bit Unicode string where ASCII text (<=U+007F) remains unchanged as a single byte, U+0080-07FF (including Latin, Greek, Cyrillic, Hebrew, and Arabic) is converted to a 2-byte sequence, and U+0800-FFFF (Chinese, Japanese, Korean, and others) becomes a 3-byte sequence.
The advantage is that most ASCII text remains unchanged and almost all editors can read it.
Windows NT4.0 supports Unicode<->UTF8 translation via MultiByteToWideChar()/WideCharToMultiByte(), using CP_UTF8 for the CodePage parameter, but it only works when none of the flags are set for dwFlags (therefore, you need to specify 0 for dwFlags).
Also, UTF8 is not a valid encoding for command line arguments for Windows NT 4.0 or 5.0, and it is not supported on Windows 95.
#3
对了,实际转换时需要将%去掉,并将%E4%BB这样形式的转换成二进制的形式。
char* text[]={0xE4, 0xBB,...};
char* text[]={0xE4, 0xBB,...};
#4
不清楚呀,能给个具体的方法吗?
#5
DentistryDoctor(昨日黄花不再美) :
对了,实际转换时需要将%去掉,并将%E4%BB这样形式的转换成二进制的形式。
char* text[]={0xE4, 0xBB,...};
请问怎么实际转换呀?
对了,实际转换时需要将%去掉,并将%E4%BB这样形式的转换成二进制的形式。
char* text[]={0xE4, 0xBB,...};
请问怎么实际转换呀?
#6
http://club.5ivb.net/dispbbs.asp?boardID=3&Page=1&ID=38196
#7
不能解决呀,请问大家有办法吗?
#8
如果是汉字的机器码,你可以根据高低字节方便的得到汉字
比如“啊”的机器码为0xb0a1,那么可以通过如下方式得到汉字
(你可以在baidu的搜索中输入关键字“啊”,则可以得到如下网址)
http://www.baidu.com/s?wd=%B0%A1&cl=3)
CString str;
str.Format(_T("%c%c"), 0xb0, 0xa1);
但是根据你给的%E4%BB%80%E4%B9%88,却得不到正确的汉字,不知道是不是如ls的所说,是加了密的。。。
比如“啊”的机器码为0xb0a1,那么可以通过如下方式得到汉字
(你可以在baidu的搜索中输入关键字“啊”,则可以得到如下网址)
http://www.baidu.com/s?wd=%B0%A1&cl=3)
CString str;
str.Format(_T("%c%c"), 0xb0, 0xa1);
但是根据你给的%E4%BB%80%E4%B9%88,却得不到正确的汉字,不知道是不是如ls的所说,是加了密的。。。
#9
哦。。没有看到最后还有一个prov=&utf8。那就按如下做。。。
TCHAR str[256]= {0xE4, 0xBB, 0x80, 0xE4, 0xB9, 0x88};
WCHAR *strSrc;
int iLen = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
strSrc = new WCHAR[iLen+1];
MultiByteToWideChar(CP_UTF8, 0 , str, -1, strSrc, iLen);
iLen = WideCharToMultiByte(CP_ACP, 0, strSrc, -1, NULL, 0, NULL, NULL);
TCHAR* strRes = new TCHAR[iLen+1];
WideCharToMultiByte(CP_ACP, 0, strSrc, -1, strRes, iLen, NULL, NULL);
//strRes即结果
//最后要释放
delete []strSrc;
delete []strRes;
TCHAR str[256]= {0xE4, 0xBB, 0x80, 0xE4, 0xB9, 0x88};
WCHAR *strSrc;
int iLen = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
strSrc = new WCHAR[iLen+1];
MultiByteToWideChar(CP_UTF8, 0 , str, -1, strSrc, iLen);
iLen = WideCharToMultiByte(CP_ACP, 0, strSrc, -1, NULL, 0, NULL, NULL);
TCHAR* strRes = new TCHAR[iLen+1];
WideCharToMultiByte(CP_ACP, 0, strSrc, -1, strRes, iLen, NULL, NULL);
//strRes即结果
//最后要释放
delete []strSrc;
delete []strRes;
#1
那个应该是加过密的吧
#2
通过MultiByteToWideChar()/WideCharToMultiByte()在UTF-8与Unicode字符串间进行转换,Code page用CP_UTF8
UTF8 is a code page that uses a string of bytes to represent a 16-bit Unicode string where ASCII text (<=U+007F) remains unchanged as a single byte, U+0080-07FF (including Latin, Greek, Cyrillic, Hebrew, and Arabic) is converted to a 2-byte sequence, and U+0800-FFFF (Chinese, Japanese, Korean, and others) becomes a 3-byte sequence.
The advantage is that most ASCII text remains unchanged and almost all editors can read it.
Windows NT4.0 supports Unicode<->UTF8 translation via MultiByteToWideChar()/WideCharToMultiByte(), using CP_UTF8 for the CodePage parameter, but it only works when none of the flags are set for dwFlags (therefore, you need to specify 0 for dwFlags).
Also, UTF8 is not a valid encoding for command line arguments for Windows NT 4.0 or 5.0, and it is not supported on Windows 95.
UTF8 is a code page that uses a string of bytes to represent a 16-bit Unicode string where ASCII text (<=U+007F) remains unchanged as a single byte, U+0080-07FF (including Latin, Greek, Cyrillic, Hebrew, and Arabic) is converted to a 2-byte sequence, and U+0800-FFFF (Chinese, Japanese, Korean, and others) becomes a 3-byte sequence.
The advantage is that most ASCII text remains unchanged and almost all editors can read it.
Windows NT4.0 supports Unicode<->UTF8 translation via MultiByteToWideChar()/WideCharToMultiByte(), using CP_UTF8 for the CodePage parameter, but it only works when none of the flags are set for dwFlags (therefore, you need to specify 0 for dwFlags).
Also, UTF8 is not a valid encoding for command line arguments for Windows NT 4.0 or 5.0, and it is not supported on Windows 95.
#3
对了,实际转换时需要将%去掉,并将%E4%BB这样形式的转换成二进制的形式。
char* text[]={0xE4, 0xBB,...};
char* text[]={0xE4, 0xBB,...};
#4
不清楚呀,能给个具体的方法吗?
#5
DentistryDoctor(昨日黄花不再美) :
对了,实际转换时需要将%去掉,并将%E4%BB这样形式的转换成二进制的形式。
char* text[]={0xE4, 0xBB,...};
请问怎么实际转换呀?
对了,实际转换时需要将%去掉,并将%E4%BB这样形式的转换成二进制的形式。
char* text[]={0xE4, 0xBB,...};
请问怎么实际转换呀?
#6
http://club.5ivb.net/dispbbs.asp?boardID=3&Page=1&ID=38196
#7
不能解决呀,请问大家有办法吗?
#8
如果是汉字的机器码,你可以根据高低字节方便的得到汉字
比如“啊”的机器码为0xb0a1,那么可以通过如下方式得到汉字
(你可以在baidu的搜索中输入关键字“啊”,则可以得到如下网址)
http://www.baidu.com/s?wd=%B0%A1&cl=3)
CString str;
str.Format(_T("%c%c"), 0xb0, 0xa1);
但是根据你给的%E4%BB%80%E4%B9%88,却得不到正确的汉字,不知道是不是如ls的所说,是加了密的。。。
比如“啊”的机器码为0xb0a1,那么可以通过如下方式得到汉字
(你可以在baidu的搜索中输入关键字“啊”,则可以得到如下网址)
http://www.baidu.com/s?wd=%B0%A1&cl=3)
CString str;
str.Format(_T("%c%c"), 0xb0, 0xa1);
但是根据你给的%E4%BB%80%E4%B9%88,却得不到正确的汉字,不知道是不是如ls的所说,是加了密的。。。
#9
哦。。没有看到最后还有一个prov=&utf8。那就按如下做。。。
TCHAR str[256]= {0xE4, 0xBB, 0x80, 0xE4, 0xB9, 0x88};
WCHAR *strSrc;
int iLen = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
strSrc = new WCHAR[iLen+1];
MultiByteToWideChar(CP_UTF8, 0 , str, -1, strSrc, iLen);
iLen = WideCharToMultiByte(CP_ACP, 0, strSrc, -1, NULL, 0, NULL, NULL);
TCHAR* strRes = new TCHAR[iLen+1];
WideCharToMultiByte(CP_ACP, 0, strSrc, -1, strRes, iLen, NULL, NULL);
//strRes即结果
//最后要释放
delete []strSrc;
delete []strRes;
TCHAR str[256]= {0xE4, 0xBB, 0x80, 0xE4, 0xB9, 0x88};
WCHAR *strSrc;
int iLen = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
strSrc = new WCHAR[iLen+1];
MultiByteToWideChar(CP_UTF8, 0 , str, -1, strSrc, iLen);
iLen = WideCharToMultiByte(CP_ACP, 0, strSrc, -1, NULL, 0, NULL, NULL);
TCHAR* strRes = new TCHAR[iLen+1];
WideCharToMultiByte(CP_ACP, 0, strSrc, -1, strRes, iLen, NULL, NULL);
//strRes即结果
//最后要释放
delete []strSrc;
delete []strRes;