asp中接收到querystring是utf-8编码的处理方式
2008-05-27 15:44
302 查看
<%
response.charset = "utf-8"
response.write URLDecode(request.querystring("msg") +"<BR>")
Function URLDecode(sConvert)
Dim aSplit
Dim sOutput
Dim I
If IsNull(sConvert) Then
URLDecode = ""
Exit Function
End If
' convert all pluses to spaces
sOutput = REPLACE(sConvert, "+", " ")
' next convert %hexdigits to the character
aSplit = Split(sOutput, "%")
If IsArray(aSplit) Then
sOutput = aSplit(0)
For I = 0 to UBound(aSplit) - 1
sOutput = sOutput & _
Chr("&H" & Left(aSplit(i + 1), 2)) &_
Right(aSplit(i + 1), Len(aSplit(i + 1)) - 2)
Next
End If
URLDecode = sOutput
End Function
%>
将ASP的页面charset设置为utf-8之后解码就不会有乱码了.
response.charset = "utf-8"
response.write URLDecode(request.querystring("msg") +"<BR>")
Function URLDecode(sConvert)
Dim aSplit
Dim sOutput
Dim I
If IsNull(sConvert) Then
URLDecode = ""
Exit Function
End If
' convert all pluses to spaces
sOutput = REPLACE(sConvert, "+", " ")
' next convert %hexdigits to the character
aSplit = Split(sOutput, "%")
If IsArray(aSplit) Then
sOutput = aSplit(0)
For I = 0 to UBound(aSplit) - 1
sOutput = sOutput & _
Chr("&H" & Left(aSplit(i + 1), 2)) &_
Right(aSplit(i + 1), Len(aSplit(i + 1)) - 2)
Next
End If
URLDecode = sOutput
End Function
%>
将ASP的页面charset设置为utf-8之后解码就不会有乱码了.
相关文章推荐
- 如何处理提交页面是GB2312编码格式,接收页面是UTF-8格式?
- 如何处理提交页面是GB2312编码格式,接收页面是UTF-8格式?
- 如何处理提交页面是GB2312编码格式,接收页面是UTF-8格式
- ASP.NET中将导出的数据以UTF-8编码方式进行存储
- 解决全局utf-8编码下asp.net接收gb2312乱码的问题
- 【杂谈】Unicode,UTF-8等编码方式的小总结
- 请问有没有办法更改 windows 下 cmd(dos) 编码方式 将其改为UTF-8
- asp.net 一般处理程序接收上传文件的问题
- Asp 页面 utf-8转gb2312编码
- Utf-8编码处理(解决c++/MFC下的乱码问题)
- Latex中文utf-8编码的三种方式
- 在jsp页面page指令中pageEncoding怎么设置默认编码方式为utf-8?
- [原]几种流行php编辑器对utf-8编码 bom问题的处理比较
- Asp 输出编码为UTF-8格式的XML内容的注意事项
- asp 实现对SQL注入危险字符进行重编码处理的函数
- Jquery下Json数据的传递与解析(asp.net mvc与asp.net api下后台json接收方式的不同)
- 正确理解UNICODE UTF-8等编码方式
- ASP.NET MVC中错误处理方式
- ANSI、UNICODE、UTF-8、UTF-16、GB2312等编码方式详解
- ASP.NET的错误处理方式