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 ...
随机推荐
- const修饰指针的三种效果
当用const进行修饰时,根据const位置的不同有三种不同效果. 判断的标准是:const修饰谁,谁的内容就是不可变的. 1 const int *p = &a; const修饰*p, *p ...
- 转 fiddler常见的应用场景
fiddler常见的应用场景 在移动互联网时代,作为软件测试工程师,fiddler绝对是值得掌握并添加进技术栈里的工具之一. 那么,fiddler在日常的测试工作中,一般都有哪些常见的应用场景呢? ...
- C#语言————第一章 第一个C#程序
第一章 第一个C#程序 ******************C#程序*************** ①:建立项目:文件-->新建-->项目-->c#-->控制台程 ...
- 32_使用BeanUtils工具包操作JavaBean
由于对属性设置值和得到值的需求很多,使用频率很高,所以有一些开源勇士 不满足于JavaBean API 中IntroSpector来操作bean, 写出来了通用的BeanUtils工具,来进一步简 ...
- Django框架的使用教程--mysql数据库[三]
Django的数据库 1.在Django_test下的view.py里面model定义模型 from django.db import models # Create your models here ...
- Alpha冲刺! Day8 - 砍柴
Alpha冲刺! Day8 - 砍柴 今日已完成 晨瑶:写了部分gitkraken团队协作教程:讨论关于继承baseActivity因为需要参数无法通过override去实现函数,并且initData ...
- Activity与view
Activity的作用:一个Activity相当于一个容器,用于存放各种控件的容器,也可以理解为是与用户交互的接口 创建Activity的要点: 1.一个Activity就是一个类,并且这个类要继承 ...
- File类_构造函数
File类:用来将文件或者文件夹封装成对象方便对文件或或文件夹的属性信息进行操作File对象可以作为参数传递给流的构造函数 import java.io.File; public class File ...
- 控件布局_TableLayout
<?xml version="1.0" encoding="utf-8"?> <TableLayout xmlns:android=" ...
- python随机生成6位数验证码
#随机生成6位数验证码 import randomcode = []for i in range(6): if i == str(random.randint(1,5)): cod ...