Encoding ASP/VBScript服务器XMLHTTP编码

Encoding ASP/VBScript服务器XMLHTTP编码,encoding,asp-classic,vbscript,serverxmlhttp,Encoding,Asp Classic,Vbscript,Serverxmlhttp,我正在使用ServerXmlHttp从远程位置提取RSS源: 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从远程位置提取RSS源:

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时,有人有任何指导吗


谢谢。

在非结构化网页中查看时,浏览器可能没有使用正确的编码

当XML加载到类似XMLDOM的解析器中时,编码应该得到尊重并正确显示


有关更多信息,请参阅。

这里有几个可能的问题

  • ASP页面使用的代码页和字符集是什么
  • 这可以通过指令或Response.CodePage和Response.Charset设置

  • XML文件的编码是什么

  • 经典ASP对这些东西的支持是出了名的糟糕,最安全的方法是坚持单一编码,最好是UTF-8(代码页65001)。

    经过几个小时的调查,我的结果如下:

    不起作用:

    <%@ Language=VBScript 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 
    %>
    
    
    
    <%@ 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 
    %>