既然是utf8,就不用bytes2BSTR(html)了

解决方案 »

  1.   

    可问题 是不用bytes2BSTR(html)也不能显示呀.
      

  2.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>怎么办?</title>
    <SCRIPT LANGUAGE="VBSCRIPT">
    Function bytes2BSTR(vIn)
        strReturn = ""
        For i = 1 To LenB(vIn)
            ThisCharCode = AscB(MidB(vIn,i,1))
            If ThisCharCode < &H80 Then
                strReturn = strReturn & Chr(ThisCharCode)
            Else
                NextCharCode = AscB(MidB(vIn,i+1,1))
                strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
                i = i + 1
            End If
        Next
        bytes2BSTR = strReturn
    End FunctionFunction momoca(path,file,name,ext)
    dim XmlHttp,url
    url="/"+path+"/"+file+"."+ext
    set XmlHttp = CreateObject("Microsoft.XMLHTTP")
    XmlHttp.Open "GET", url, false 
    XmlHttp.setRequestHeader "Content-Type","text/html; charset=utf-8"If xmlHttp.readyState < 4 then
    eval("document.all."+name).innerHTML="loading...<br>页面载入中请等待..."
    End IfXmlHttp.SendIf xmlHttp.readyState = 4 then
    eval("document.all."+name).innerHTML="页面载入成功 —— by momcoa"
    End Ifdim html 
    html = XmlHttp.responseBody
    html = bytes2BSTR(html) //不管用不用这句,都不对.
    eval("document.all."+name).innerHTML=html
    End Function
    </script></head><body>
    <span id="momoca_1"></span>
    <script language="javascript">momoca("modules/purchase/template","123","momoca_1","html");
    ///modules/purchase/template/123.html 这个页是一个UTF-8的页</script>
    </body>
    </html>
    求求大家解决一下上吧.都是UTF-8的页为什么读出来 是乱码呢?
      

  3.   

    客户端发出时在中文外面加函数:
    配置<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    并且发送的时候用
    var str  ="app="+encodeURI("中文");
    xmlhttp.send(str)方式发送。
      

  4.   

    1
    <%
    Function getHTTPPage(url) 
    dim http 
    set http=Server.createobject("Microsoft.XMLHTTP")
    if instr(url,"http://")=0 then url="http://"&url
    Http.open "GET",url,false 
    Http.send() 
    if Http.readystate<>4 then
    exit function 
    end if 
    getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
    set http=nothing
    if err.number<>0 then err.Clear
    End function

    Function BytesToBstr(body,Cset)
    dim objstream
    set objstream = Server.CreateObject("adodb.stream")
    objstream.Type = 1
    objstream.Mode =3
    objstream.Open
    objstream.Write body
    objstream.Position = 0
    objstream.Type = 2
    objstream.Charset = Cset
    BytesToBstr = objstream.ReadText 
    objstream.Close
    set objstream = nothing
    End Functionresponse.Write getHTTPPage("http://www.sina.com.cn/")
    %>
      

  5.   

    <%
    Function BytesToBstr(body)
    dim objstream
    set objstream = Server.Create_Object("adodb.stream")
    objstream.Type = 1
    objstream.Mode =3
    objstream.Open
    objstream.Write body
    objstream.Position = 0
    objstream.Type = 2
    objstream.Charset = "utf-8"
    BytesToBstr = objstream.ReadText 
    objstream.Close
    set objstream = nothing
    End Function
    %>用JS有办法实现吗?
      

  6.   

    就两个页,都是UTF-8的.
    想有A页读出B页的内容.
    <SCRIPT LANGUAGE="VBSCRIPT">
    dim XmlHttp,url
    set XmlHttp = CreateObject("Microsoft.XMLHTTP")
    XmlHttp.Open "GET", "http://www.google.com/intl/zh-CN/", false 
    XmlHttp.setRequestHeader "Content-Type","text/html; charset=utf-8"
    XmlHttp.Send
    dim html 
    html = XmlHttp.responseBody
    eval("document.all."+name).innerHTML=html
    </SCRIPT>
      

  7.   

    <SCRIPT LANGUAGE="JavaScript">
    <!--function zhiSelect(obj){
    var r = document.selection.createRange();
    r.moveToElementText(obj);
    r.moveToPoint(event.x, event.y);
    r.expand("word");
    r.select();
    }//-->
    </SCRIPT>
    <span id = "dictz_status" onmousemove="zhiSelect(this)">
    但我想把它轉為..............
    </span>
      

  8.   

    哦,贴错):
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"><script language="javascript">
    var http_request = false;
    function send_request(url) {//初始化、指定处理函数、发送请求的函数
    http_request = false;
    //开始初始化XMLHttpRequest对象
    if(window.XMLHttpRequest) { //Mozilla 浏览器
    http_request = new XMLHttpRequest();
    if (http_request.overrideMimeType) {//设置MiME类别
    http_request.overrideMimeType('text/xml');
    }
    }
    else if (window.ActiveXObject) { // IE浏览器
    try {
    http_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    try {
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {}
    }
    }

    if (!http_request) { // 异常,创建对象实例失败
    window.alert("不能创建XMLHttpRequest对象实例.");
    return false;
    }
    //http_request.onreadystatechange = processRequest;
    // 确定发送请求的方式和URL以及是否同步执行下段代码
    http_request.open("GET", url, true);
    http_request.send(null);
    div1.innerHTML = http_request.responseText;

        
    </script>
    </head>
    <body onload="send_request('http://www.google.com/intl/zh-CN/');"></body>
    <div id=div1></div>
    </html>
      

  9.   

    上面的代码不能读ASP或php程序吗?
      

  10.   


    <body onload="send_request('http://alixixi.com/simplerss2.asp?fboardid=8&boardid=11');">