我正在使用ServerXmlHttp从远程位置拉取一个RSS feed:
Dim httpRequest
set httpRequest = server.createObject("Msxml2.ServerXMLHTTP.6.0")
httpRequest.open "GET", "http://www.someurl.com/feed.xml", false
httpRequest.send()
response.write httpRequest.responseXML.xml然而,正如我所看到的,在这条线上的某个地方肯定存在编码问题?其中应该有一些日语字符。有人在使用ServerXmlHttp时有什么指导吗?
谢谢。
发布于 2010-04-15 02:04:53
这里有几个可能的问题。
这可以使用<%@ CodePage=xxxxx %>指令或Response.CodePage和Response.Charset进行设置。
传统的ASP对这些东西的支持是出了名的差,最安全的选择是坚持使用单一编码,最好是UTF-8 (CodePage 65001)。
发布于 2011-02-20 04:00:11
经过几个小时的调查,我的结果如下:
不起作用:
<%@ Language=VBScript Codepage=65001 %>它显示的不是正确的特殊字符,而是问号和黑色问号。
但这是可行的!!
Response.CodePage = 65001我还包括了
Response.Charset = "UTF-8"
response.AddHeader "Content-Type", "text/html;charset=UTF-8"最终结果:
<%@ Language=VBScript %>
<%
Dim xmlhttp
Set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP")
xmlhttp.open "GET", "http://www.sapo.pt", 0
xmlhttp.send ""
Dim pagina
response.AddHeader "Content-Type", "text/html;charset=UTF-8"
Response.CodePage = 65001
Response.Charset = "UTF-8"
pagina = xmlhttp.responseText
Response.Write pagina
Set xmlhttp = Nothing
%>发布于 2010-03-19 01:39:58
在非结构化网页中查看时,浏览器可能未使用正确的编码。
当XML被加载到XMLDOM这样的解析器中时,编码应该得到遵守并正确显示。
有关详细信息,请参阅XML Encoding。
https://stackoverflow.com/questions/2471736
复制相似问题