Discussion:
使用WinHttp.WinHttpRequest.5.1 結果發生 亂碼, 請問如何解?
(时间太久无法回复)
hahahacja
2007-03-17 03:00:18 UTC
Permalink
各位好
使用WinHttp.WinHttpRequest.5.1 結果發生 亂碼, 請問如何解?
asp : 只有下面幾行
------------------------
Dim objWinHttp ' HTTP request object
Set objWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
objWinHttp.Open "GET", "http://www.archi.net.tw"
objWinHttp.Send
Response.Write(objWinHttp.ResponseText)
------------------

objWinHttp.Open 的網站是 charset=BIG5
璉璉
2007-03-17 15:52:41 UTC
Permalink
http://msdn2.microsoft.com/en-us/library/aa383998.aspx

ŠA Send «e³]©w codepage ¡H
¹w³]¬O utf-8 ¡C
©ó news:8D9D8DA6-6F90-49BF-8AF2-9C8FEC77663F%40microsoft.com µoªí
ŠUŠìŠn
šÏ¥ÎWinHttp.WinHttpRequest.5.1 µ²ªGµo¥Í ¶ÃœX, œÐ°ÝŠpŠóžÑ?
asp : ¥uŠ³€U­±ŽXŠæ
------------------------
Dim objWinHttp ' HTTP request object
Set objWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
objWinHttp.Open "GET", "http://www.archi.net.tw"
objWinHttp.Send
Response.Write(objWinHttp.ResponseText)
------------------
objWinHttp.Open ªººô¯ž¬O charset=BIG5
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.6 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.twbbs.org/wwwmap.htm
¬y°ìšŸ¬x/°Ï°ì€ôžê·œ/®}ª@ºô/ªŽºÀ¹Ï/»y­µ³q°T €å³¹»Pµ{Š¡
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
·L³nµ{Š¡³]­p¡Bšt²ÎºÞ²zšÏ¥Î·s§Þ³Nœ×ŸÂ°Qœ×°Ï¡Aºô€ÍŠ^ÂЫá§Y®É²°T¡B¹q€l¶l¥ó³qªŸ¡G
MSDN: http://forums.microsoft.com/msdn-cht/default.aspx?siteid=14
TechNet: http://forums.microsoft.com/technet-cht/default.aspx?siteid=23
--
ASPNET News Reader http://tlcheng.twbbs.org/News/Reader.aspx
RSS 2.0 http://tlcheng.twbbs.org/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.aspnet
璉璉
2007-03-17 16:30:01 UTC
Permalink
­è­èžÕ¹L³oŒËšS¥Î¡Ažò xmlHttp €@ŒË¡A³£­nŪŠš Bytes ŠAÂàŽ«¡C

§ï¥Î
arrBytes = objWinHttp.ResponseBody
Response.Write SlowBytesToBSTR(arrBytes)

Function SlowBytesToBSTR(ByVal arrBytes)
strReturn = ""
arrBytes = CStr(arrBytes)
For i = 1 To LenB(arrBytes)
ThisCharCode = AscB(MidB(arrBytes, i, 1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(arrBytes, i + 1, 1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
SlowBytesToBSTR = strReturn
End Function
©ó news:000001c768ac%244b4c6570%240a03a8c0%40c2e6400 µoªí
http://msdn2.microsoft.com/en-us/library/aa383998.aspx
ŠA Send «e³]©w codepage ¡H
¹w³]¬O utf-8 ¡C
©ó news:8D9D8DA6-6F90-49BF-8AF2-9C8FEC77663F%40microsoft.com µoªí
ŠUŠìŠn
šÏ¥ÎWinHttp.WinHttpRequest.5.1 µ²ªGµo¥Í ¶ÃœX, œÐ°ÝŠpŠóžÑ?
asp : ¥uŠ³€U­±ŽXŠæ
------------------------
Dim objWinHttp ' HTTP request object
Set objWinHttp = Server.CreateObject("WinHttp.WinHttpRequest.5.1")
objWinHttp.Open "GET", "http://www.archi.net.tw"
objWinHttp.Send
Response.Write(objWinHttp.ResponseText)
------------------
objWinHttp.Open ªººô¯ž¬O charset=BIG5
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.6 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.twbbs.org/wwwmap.htm
¬y°ìšŸ¬x/°Ï°ì€ôžê·œ/®}ª@ºô/ªŽºÀ¹Ï/»y­µ³q°T €å³¹»Pµ{Š¡
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
·L³nµ{Š¡³]­p¡Bšt²ÎºÞ²zšÏ¥Î·s§Þ³Nœ×ŸÂ°Qœ×°Ï¡Aºô€ÍŠ^ÂЫá§Y®É²°T¡B¹q€l¶l¥ó³qªŸ¡G
MSDN: http://forums.microsoft.com/msdn-cht/default.aspx?siteid=14
TechNet: http://forums.microsoft.com/technet-cht/default.aspx?siteid=23
--
ASPNET News Reader http://tlcheng.twbbs.org/News/Reader.aspx
RSS 2.0 http://tlcheng.twbbs.org/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.aspnet
继续阅读narkive:
Loading...