我的网站现在完全使用UTF-8编码,但是为了使用serverXMLHTTP发送短信,我需要在发送之前将消息从UTF-8转换为ISO-8859-1。
这种情况类似于:
a.asp:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body>
<form method="post" action="b.asp">
<input type text name="message" value="æøå and ÆØÅ"><br>
<input type=submit>
</body>
然后是b.asp
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head><body>
<%=konvert(request("message"))%><br>
</body>
<%
Function Konvert(sIn)
Dim oIn : Set oIn = CreateObject("ADODB.Stream")
oIn.Open
oIn.CharSet = "UTF-8"
oIn.WriteText sIn
oIn.Position = 0
oIn.CharSet = "ISO-8859-1"
Konvert = oIn.ReadText
oIn.Close
End Function
%>
在这个展示中,我希望在 b.asp 中看到与我在 a.asp 中发送的相同字符串,但实际上我得到了这个:
æøå and ÆØÅ
有什么想法吗?