+ -
当前位置:首页 → 问答吧 → 关于程序在香港空间上显示为繁体的问题

关于程序在香港空间上显示为繁体的问题

时间:2011-12-12

来源:互联网

我写的ASP程序就是通过,XMLHTTP对象,获取一段文本,然后输入在网页上,程序在美国空间上可以使用,可以输入简体汉字
但是程序,放到香港空间上后,他就输入的是繁体字,请问这个问题,怎么解决呢?
以下这是代码,大家帮忙看看应该怎么改,才可以让香港空间上也输入为简体字呢

VBScript code


'========================================
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 Function
'========================================
Function PostHttpPage(RefererUrl,PostUrl,PostData) 
    Dim xmlHttp 
    Dim RetStr      
    Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")  
    xmlHttp.Open "POST", PostUrl, False
    XmlHTTP.setRequestHeader "Content-Length",Len(PostData) 
    xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    xmlHttp.setRequestHeader "Referer", RefererUrl
    'xmlHttp.setRequestHeader "Cookie", getcookie       
    xmlHttp.Send PostData 
    If Err.Number <> 0 Then 
        Set xmlHttp=Nothing
        PostHttpPage = "$False$"
        Exit Function
    End If
    xmlHttp.open "GET",RefererUrl,false
    xmlHttp.send()
    if xmlHttp.readystate<>4 then 
        exit function
    end if
    PostHttpPage=bytesToBSTR(xmlHttp.responseBody,"GB2312")
    Set xmlHttp = nothing
End Function 


作者: zhangyaocom   发布时间: 2011-12-12

可能是服务器设置的原因 或者你换一种编码方式看看 utf-8

作者: hefeng_aspnet   发布时间: 2011-12-12

如果把编码转换成UTF-8后,上面那个posthttppage返回的内容,就不对了

作者: zhangyaocom   发布时间: 2011-12-12