asp 有Server.HTMLEncode 却没有 Server.HTMLDecode.......

需要自定义一个 HTMLDecode 函数:

Function HTMLDecode(sText)
dim I
sText = Replace(sText, """, Chr(34))
sText = Replace(sText, "<", Chr(60))
sText = Replace(sText, ">", Chr(62))
sText = Replace(sText, "&" , Chr(38))
sText = Replace(sText, " ", Chr(32))
For I = 1 to 255
sText = Replace(sText, "&#" & I & ";", Chr(I))
Next
HTMLDecode = sText
End Function

  

例子:

<%

Dim j
Response.Write(Server.HTMLEncode("encode: 555 <p>hhhh</p>jj ffff 888 ") & "<br>-----------------------------<br>")
Response.Write(HTMLDecode("decod: 555 <p>hhhh</p>jj ffff 888 "))
Function HTMLDecode(sText)
dim I
sText = Replace(sText, """, Chr(34))
sText = Replace(sText, "<", Chr(60))
sText = Replace(sText, ">", Chr(62))
sText = Replace(sText, "&" , Chr(38))
sText = Replace(sText, " ", Chr(32))
For I = 1 to 255
sText = Replace(sText, "&#" & I & ";", Chr(I))
Next
HTMLDecode = sText
End Function
%>

  

ASP HTMLEncode/HTMLDecode的更多相关文章

  1. javascript 实现htmlEncode htmlDecode

    屌屌的写法..function htmlEncode(value){ //create a in-memory div, set it's inner text(which jQuery automa ...

  2. js转义和反转义html htmlencode htmldecode

    文章目录 JS实现HTML标签转义及反转义 用Javascript进行HTML转义 1.HTML转义 2.反转义 3.一个有意思的认识 4.完整版本的代码 其他 [转义字符]HTML 字符实体< ...

  3. 几种HtmlEncode的区别(转)

    一.C#中的编码 HttpUtility.HtmlDecode.HttpUtility.HtmlEncode与Server.HtmlDecode.Server.HtmlEncode与HttpServe ...

  4. (转)几种HtmlEncode的区别

    一.C#中的编码 HttpUtility.HtmlDecode.HttpUtility.HtmlEncode与Server.HtmlDecode.Server.HtmlEncode与HttpServe ...

  5. 06 ASP.net

    ASP.net 第一天 理解浏览器与服务器概念,与WinForm的区别. C# IIS(Internet Information Service) 互联网信息服务 Java(Tomcat) Php(A ...

  6. 第十五节:HttpContext五大核心对象的使用(Request、Response、Application、Server、Session)

    一. 基本认识 1. 简介:HttpContext用于保持单个用户.单个请求的数据,并且数据只在该请求期间保持: 也可以用于保持需要在不同的HttpModules和HttpHandlers之间传递的值 ...

  7. HttpContext对象下的属性Application、Cache、Request、Response、Server、Session、User

    概述: HttpContext封装关于单个HTTP请求的所有HTTP特定信息. HttpContext基于HttpApplication的处理管道,由于HttpContext对象贯穿整个处理过程,所以 ...

  8. asp.net Server.HtmlEncode和HtmlDecode

    <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">< ...

  9. 【C#】C#中的HtmlEncode与HtmlDecode:HttpUtility.HtmlEncode,HttpUtility.HtmlDecode,Server.HtmlEncode,Server.HtmlDecode,WebUtility.HtmlEncode,WebUtility.HtmlDecode

    HtmlEncode(String) 将字符串转换为 HTML 编码字符串. HtmlDecode(String) 将已经为 HTTP 传输进行过 HTML 编码的字符串转换为已解码的字符串. 在we ...

随机推荐

  1. Fiddler 使用fiddler发送捕获的请求及模拟服务器返回

    使用fiddler发送捕获的请求及模拟服务器返回 by:授客 QQ:1033553122 1.做好相关监听及代理设置 略 2.发送捕获的请求 如图 3.模拟服务器返回 本例的一个目的是,根据服务器返回 ...

  2. 排错-安装SQl 2008“为SQL Server代理服务提供的凭据无效的解决方法

    安装SQl 2008“为SQL Server代理服务提供的凭据无效的解决方法 by:授客 QQ:1033553122 在Windows Server 2008安装SQL Server 2008出现的问 ...

  3. Angular2 富文本编辑器 ng2-ckeditor 的使用

    本文介绍如何在 Angular 中使用 ng2-ckeditor 控件,示例代码基于 angular 6.0.2,node 8.11.2,  ng2-ckeditor 4.9.2 环境   1. 安装 ...

  4. Kotlin入门(3)基本变量类型的用法

    上一篇文章介绍了Kotlin在App开发中的简单用法,包括操纵控件对象.设置控件监听器,以及弹出Toast提示等等.也许大家已经迫不及待想要了解更深入的App开发,可是由于Kotlin是一门全新的语言 ...

  5. 使用linq语句进行联表查询

    假设你有一个父表(例如:汽车),其关联一个子表,例如轮子(一对多).现在你想对于所有的父表汽车,遍历所有汽车,然后打印出来所有轮子的信息.默认的做法将是: SELECT CarId FROM Cars ...

  6. SAP CRM 开发学习资料和教程整理【不定时更新】

    本文链接:http://www.cnblogs.com/hhelibeb/p/6276929.html 首先是SAP网站上面的相关内容 SAP Customer Relationship Manage ...

  7. jQuery EasyUI combobox多选及赋值

      1.多选属性multiple multiple:true多选 multiple:false单选 <input class="easyui-combobox" id=&qu ...

  8. ucml 连接虚字段

  9. Ubuntu无法连接WiFi

    lspci | grep Network1.查看自己的无线网卡驱动2.下载驱动https://www.intel.cn/content/www/cn/zh/support/articles/00000 ...

  10. AI 概率论

    概率论 不确定性 量化 频率 频率派 贝叶斯派 1.随机变量(random variable) 随机取不同值的变量,取值可以离散或者连续. 2.概率分布(probability distributio ...