ASP 转换HTML特殊字符

 1     Function HtmlDecode(ByVal s)
 2         If Has(s) Then
 3             s = regReplace(s, "<br\s*/?\s*>", vbCrLf)
 4             s = Replace(s, "&nbsp;&nbsp; &nbsp;", Chr(9))
 5             s = Replace(s, "&quot;", Chr(34))
 6             s = Replace(s, "&nbsp;", Chr(32))
 7             s = Replace(s, "&#39;", Chr(39))
 8             s = Replace(s, "&apos;", Chr(39))
 9             s = Replace(s, "&gt;", ">")
10             s = Replace(s, "&lt;", "<")
11             s = Replace(s, "&amp;", Chr(38))
12             s = Replace(s, "&#38;", Chr(38))
13             s = Replace(s, "&times;", "×")
14             s = Replace(s, "&divide;", "÷")
15             s = Replace(s, "&frac14;", "¼")
16             s = Replace(s, "&frac12;", "½")
17             s = Replace(s, "&frac34;", "¾")
18             s = Replace(s, "&plusmn;", "±")
19             s = Replace(s, "&laquo;", "«")
20             s = Replace(s, "&raquo;", "»")
21             s = Replace(s, "&copy;", "©")
22             s = Replace(s, "&reg;", "®")
23             s = Replace(s, "&deg;", "°")
24         End If
25         HtmlDecode = s
26     End Function

 

posted @ 2016-07-20 11:14  Bit5566  阅读(425)  评论(0编辑  收藏  举报