请问,怎么样用ASP过滤掉中文特殊字符?

来源:百度知道 编辑:UC知道 时间:2024/06/22 03:34:31
比如想过滤❤
我用replace了,但是代码文件是ANSI,根本就写不上❤,是乱码
1楼 想知道具体代码
2楼 用ASP,不用.NET
3楼 是中文特殊字符,不是英文特殊字符

判断ascii值吧

1、用string的replace成员函数。
2、用正则表达式。
这里是一个c#写的html代码过滤函数,你可以参考一下:
public string checkStr(string html)
{
System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex(@"<script[\s\S]+</script *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex(@" href *= *[\s\S]*script *:", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex3 = new System.Text.RegularExpressions.Regex(@" on[\s\S]*=", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex4 = new System.Text.RegularExpressions.Regex(@"<iframe[\s\S]+</iframe *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.T