asp utf8到gb2312

 if Len(city)>0 then
    x = gb2utf8(city)
    if x<>"" then
        city = x
    end if
end if
Function gb2utf8(s)
    Dim byt
    Set byt = CreateObject("ADODB.Stream")
    byt.Type = 2   
    byt.CharSet = "GB2312"
    byt.Open
    byt.WriteText s
    byt.Position = 0
    byt.CharSet = "UTF-8"
    gb2utf8 = byt.ReadText
    byt.Close   
    Set byt = Nothing
End Function

你可能感兴趣的:(function,asp)