InternetReadFile字符编码 [英] InternetReadFile Character Encoding

查看:539
本文介绍了InternetReadFile字符编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我在Visual C ++中使用了一小段代码.效果很好.
我在C#中引入了同一段代码,却得到了奇怪的字符.

它似乎是一个编码问题(服务器为1and1).当我尝试用Win bloc注释保存字符串时,他说文本是Unicode.那么,如何从Unicode转换为ASCII?非常感谢您的关注.
尼古拉斯.

代码提取:

Hello,
I use a little piece of code in Visual C++. It works perfect.
I bring the same piece of code in C# and I get strange char.

It seams to be an encoding problem (the server is 1and1). When I try to save the string with the Win bloc note, he say the text is Unicode. So how can I go from Unicode to ASCII? Thanks a lot for your interest.
Nicolas.

Code extract :

hInternetSession = InternetOpen("VA", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0); 
hInternetUrl = InternetOpenUrl(hInternetSession, (LPCSTR)txt, NULL, 0, 0 , 0); 
InternetReadFile(hInternetUrl, (LPVOID)szTemp,126, &dwRead);
HttpQueryInfo((HINTERNET)HTTP_QUERY_RAW_HEADERS,(DWORD)szTemp, &dwRead, 0, NULL);
InternetCloseHandle(hInternetUrl); 
InternetCloseHandle(hInternetSession);

推荐答案

您好,

我回答自己.
没关系.它是UTF-7编码.
我尝试了所有可能性后才找到它.
抱歉打扰了.
大家晚上好
尼古拉斯(Nicolas)
Hello,

I answer my self.
It''s OK. It was UTF-7 encoding.
I found it after i try all possibilities.
I''m sorry to disturb .
Good Evening to all
Nicolas


这篇关于InternetReadFile字符编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆