ASP HTMLEncode/HTMLDecode
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的更多相关文章
- javascript 实现htmlEncode htmlDecode
屌屌的写法..function htmlEncode(value){ //create a in-memory div, set it's inner text(which jQuery automa ...
- js转义和反转义html htmlencode htmldecode
文章目录 JS实现HTML标签转义及反转义 用Javascript进行HTML转义 1.HTML转义 2.反转义 3.一个有意思的认识 4.完整版本的代码 其他 [转义字符]HTML 字符实体< ...
- 几种HtmlEncode的区别(转)
一.C#中的编码 HttpUtility.HtmlDecode.HttpUtility.HtmlEncode与Server.HtmlDecode.Server.HtmlEncode与HttpServe ...
- (转)几种HtmlEncode的区别
一.C#中的编码 HttpUtility.HtmlDecode.HttpUtility.HtmlEncode与Server.HtmlDecode.Server.HtmlEncode与HttpServe ...
- 06 ASP.net
ASP.net 第一天 理解浏览器与服务器概念,与WinForm的区别. C# IIS(Internet Information Service) 互联网信息服务 Java(Tomcat) Php(A ...
- 第十五节:HttpContext五大核心对象的使用(Request、Response、Application、Server、Session)
一. 基本认识 1. 简介:HttpContext用于保持单个用户.单个请求的数据,并且数据只在该请求期间保持: 也可以用于保持需要在不同的HttpModules和HttpHandlers之间传递的值 ...
- HttpContext对象下的属性Application、Cache、Request、Response、Server、Session、User
概述: HttpContext封装关于单个HTTP请求的所有HTTP特定信息. HttpContext基于HttpApplication的处理管道,由于HttpContext对象贯穿整个处理过程,所以 ...
- asp.net Server.HtmlEncode和HtmlDecode
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">< ...
- 【C#】C#中的HtmlEncode与HtmlDecode:HttpUtility.HtmlEncode,HttpUtility.HtmlDecode,Server.HtmlEncode,Server.HtmlDecode,WebUtility.HtmlEncode,WebUtility.HtmlDecode
HtmlEncode(String) 将字符串转换为 HTML 编码字符串. HtmlDecode(String) 将已经为 HTTP 传输进行过 HTML 编码的字符串转换为已解码的字符串. 在we ...
随机推荐
- Nginx 反向代理工作原理简介与配置详解
Nginx反向代理工作原理简介与配置详解 by:授客 QQ:1033553122 测试环境 CentOS 6.5-x86_64 nginx-1.10.0 下载地址:http://nginx. ...
- Fiddler抓包使用教程-基本功能介绍
转载请标明出处:http://blog.csdn.net/zhaoyanjun6/article/details/72932886 本文出自[赵彦军的博客] Fiddler 基本页面 会话列表功能介绍 ...
- python接口测试—get请求(一)
python 做借口测试用到的是requests模块,首先要导入requests库,pip install requests 1.get直接请求方式 以豆瓣网为例: url = 'https://re ...
- 洗礼灵魂,修炼python(11)--python函数,模块
前面的章节你如果看懂了,基本算是入门了七八了,不过如果你以为python就这么点东西,你觉得很简单啊,那你就错了,真正的东西在后面,前面我说的几大核心其实也不是多么高深多么厉害的,那些东西是基础很常用 ...
- oracle中给某个用户某张表的权限设置
今天碰到需要给数据库上某一个用户,开通其中2张表的查询权限,方法如下: grant select on bas_checkcycle to jdc;这个是整个语句. 语句分析: grant selec ...
- C#语言————两值交换
//两值交换 public static void Show(ref int num1,ref int num2) { int num=num1; num1=num2; num2=num; } sta ...
- ccf题库中2015年12月2号消除类游戏
题目如下: 问题描述 消除类游戏是深受大众欢迎的一种游戏,游戏在一个包含有n行m列的游戏棋盘上进行,棋盘的每一行每一列的方格上放着一个有颜色的棋子,当一行或一列上有连续三个或更多的相同颜色的棋子时,这 ...
- Opaque data type--不透明类型
Opaque:对使用者来说,类型结构和机制明晰即为transparent,否则为Opaque In computer science, an opaque data type is a data ty ...
- EBS-新增和更新价目表行
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/gh320/article/details/36666133 新增和更新价目表行 --目的:在已 ...
- lij IDEA项目包分层结构显示设置
使用Intellij IDEA创建项目发现包没有分层,使用不方便. 可以点击右上角的设置,把红框选项的√去掉即可. 就会分层显示了,这就很舒服了.