ASP让url的中文显示为编码
2011-02-27 15:26
986 查看
asp解码url
复制代码 代码如下:
<a href="1.asp?action=<%=server.urlencode("你好")%>">asdf</a>
解码函数
[code]
<%
Function URLDecode(enStr)
dim deStr,strSpecial
dim c,i,v
deStr=""
strSpecial="!""#$%&'()*+,.-_/:;<=>?@[\]^`{|}~%"
for i=1 to len(enStr)
c=Mid(enStr,i,1)
if c="%" then
v=eval("&h"+Mid(enStr,i+1,2))
if inStr(strSpecial,chr(v))>0 then
deStr=deStr&chr(v)
i=i+2
else
v=eval("&h"+ Mid(enStr,i+1,2) + Mid(enStr,i+4,2))
deStr=deStr & chr(v)
i=i+5
end if
else
if c="+" then
deStr=deStr&" "
else
deStr=deStr&c
end if
end if
next
URLDecode=deStr
End function
response.Write URLDecode(request.QueryString("action"))
%>
[html]
复制代码 代码如下:
<a href="1.asp?action=<%=server.urlencode("你好")%>">asdf</a>
解码函数
[code]
<%
Function URLDecode(enStr)
dim deStr,strSpecial
dim c,i,v
deStr=""
strSpecial="!""#$%&'()*+,.-_/:;<=>?@[\]^`{|}~%"
for i=1 to len(enStr)
c=Mid(enStr,i,1)
if c="%" then
v=eval("&h"+Mid(enStr,i+1,2))
if inStr(strSpecial,chr(v))>0 then
deStr=deStr&chr(v)
i=i+2
else
v=eval("&h"+ Mid(enStr,i+1,2) + Mid(enStr,i+4,2))
deStr=deStr & chr(v)
i=i+5
end if
else
if c="+" then
deStr=deStr&" "
else
deStr=deStr&c
end if
end if
next
URLDecode=deStr
End function
response.Write URLDecode(request.QueryString("action"))
%>
[html]
相关文章推荐
- ASP让url的中文显示为编码
- asp.net url带中文参数显示乱码的问题
- asp.net url带中文参数显示乱码的问题
- ASP.NET中url传递中文的解决方案
- ASP.NET中url传递中文的解决方案简单汇总
- Visual Studio 2010/2013 UTF8编码调试时显示中文
- asp创建对象及中文显示解决技巧
- asp.net中url字符串编码乱码的原因与解决方法
- python处理url中的中文编码,以及其他编码问题
- java 把URL中的中文转换成utf-8编码
- URL中文编码问题之小结
- 前台页面使用utf-8编码,url中包含中文参数时后台获取参数乱码问题解决
- ASP.NET 拼装Url字符串 需要传中文的解决方案
- C# asp.net页面通过URL参数传值中文乱码问题解决办法
- ASP.NET做的网站在godaddy 的美国服务器上显示中文为乱码
- iOS url中文编码
- [转载]url带中文参数显示乱码的问题
- Visual Studio 2010/2013/2015 UTF8编码调试时显示中文
- [导入]asp.net中文编码
- C# 中文在URL中的编码