无为清净楼资源网 Design By www.qnjia.com
1. 支持参数纯汉字 ?a=深山老熊
2. 支持参数gb2312 Urlencode编码: ?a=%C9%EE%C9%BD%C0%CF%D0%DC
3. 支持参数UTF-8 Urlencode编码: ?a=%E6%B7%B1%E5%B1%B1%E8%80%81%E7%86%8A
复制代码 代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Option Explicit
Const YXCMS_CHARSET = "UTF-8"
Const YXCMS_CODEPAGE = 65001
Response.CharSet = "UTF-8"
Session.CodePage = 65001
'测试URL
'?n1=深山老熊&n2=%C9%EE%C9%BD%C0%CF%D0%DC&n3=%E6%B7%B1%E5%B1%B1%E8%80%81%E7%86%8A
'深山老熊
'GBK : %C9%EE%C9%BD%C0%CF%D0%DC
'UTF-8 : %E6%B7%B1%E5%B1%B1%E8%80%81%E7%86%8A
Dim URI,key
Set URI = new Cls_URI
'输出所有参数测试
For Each key In URI.QueryString
Response.Write "<span style='color:red'>" & key & " : </span>" & URI.Get(key) & "<hr/>"
Next
'取单个值
'URI.Get("名称")
'--------------------------------------------
'ASP UTF-8编码下通吃 GBK UTF-8编码
'作者: 深山老熊 QQ:81090
'--------------------------------------------
Class Cls_URI
Private o_item,o_regx
Private url_query
Private Sub Class_Initialize
Set o_item = CreateObject("Scripting.Dictionary")
o_item.CompareMode = 1
Set o_regx = New Regexp
o_regx.Pattern = "^(?:[\x00-\x7f]|[\xfc-\xff][\x80-\xbf]{5}|[\xf8-\xfb][\x80-\xbf]{4}|[\xf0-\xf7][\x80-\xbf]{3}|[\xe0-\xef][\x80-\xbf]{2}|[\xc0-\xdf][\x80-\xbf])+$"
Session.CodePage = 936
url_query = Request.ServerVariables("QUERY_STRING")
Session.CodePage = 65001
'根据QUERY_STRING字符串,生成模拟QueryString值
Dim i,a,b,c,n,v
a = Split(url_query,"&") : c = UBound(a)
For i = 0 To c
b = Split(a(i),"=",2)
n = Trim(b(0) & "")
If UBound(b) < 1 Then
v = ""
Else
v = b(1)
If InStr(v,"%") > 0 Then v = URLDecode(v)
End If
If n <> "" Then
o_item(n) = v
End If
Next
Set o_regx = Nothing
End Sub
Private Sub Class_Terminate
Set o_item = Nothing
End Sub
'模拟 Request.QueryString
Public Function QueryString()
Set QueryString = o_item
End Function
'模拟 Request.QueryString(n)
Public Function [GET](n)
If o_item.Exists(n) Then
[GET] = o_item.Item(n)
Else
[GET] = ""
End If
End Function
'编码格式化
Private Function URLDecode(ByVal s)
Dim sm,cs,r,o_regex
If Trim(s & "") = "" Then
URLDecode = s : Exit Function
End If
s = unescape(s)
If o_regx.Test(s) Then
cs = "UTF-8"
Else
cs = "GBK"
End If
Set sm = CreateObject("Adodb.Stream")
With sm
.Type = 2
.Mode = 3
.Open
.CharSet = "ISO-8859-1"
.WriteText s
.Position = 0
.CharSet = cs
URLDecode = .ReadText(-1)
.Close
End With
Set sm = Nothing
End Function
End Class
%>
2. 支持参数gb2312 Urlencode编码: ?a=%C9%EE%C9%BD%C0%CF%D0%DC
3. 支持参数UTF-8 Urlencode编码: ?a=%E6%B7%B1%E5%B1%B1%E8%80%81%E7%86%8A
复制代码 代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Option Explicit
Const YXCMS_CHARSET = "UTF-8"
Const YXCMS_CODEPAGE = 65001
Response.CharSet = "UTF-8"
Session.CodePage = 65001
'测试URL
'?n1=深山老熊&n2=%C9%EE%C9%BD%C0%CF%D0%DC&n3=%E6%B7%B1%E5%B1%B1%E8%80%81%E7%86%8A
'深山老熊
'GBK : %C9%EE%C9%BD%C0%CF%D0%DC
'UTF-8 : %E6%B7%B1%E5%B1%B1%E8%80%81%E7%86%8A
Dim URI,key
Set URI = new Cls_URI
'输出所有参数测试
For Each key In URI.QueryString
Response.Write "<span style='color:red'>" & key & " : </span>" & URI.Get(key) & "<hr/>"
Next
'取单个值
'URI.Get("名称")
'--------------------------------------------
'ASP UTF-8编码下通吃 GBK UTF-8编码
'作者: 深山老熊 QQ:81090
'--------------------------------------------
Class Cls_URI
Private o_item,o_regx
Private url_query
Private Sub Class_Initialize
Set o_item = CreateObject("Scripting.Dictionary")
o_item.CompareMode = 1
Set o_regx = New Regexp
o_regx.Pattern = "^(?:[\x00-\x7f]|[\xfc-\xff][\x80-\xbf]{5}|[\xf8-\xfb][\x80-\xbf]{4}|[\xf0-\xf7][\x80-\xbf]{3}|[\xe0-\xef][\x80-\xbf]{2}|[\xc0-\xdf][\x80-\xbf])+$"
Session.CodePage = 936
url_query = Request.ServerVariables("QUERY_STRING")
Session.CodePage = 65001
'根据QUERY_STRING字符串,生成模拟QueryString值
Dim i,a,b,c,n,v
a = Split(url_query,"&") : c = UBound(a)
For i = 0 To c
b = Split(a(i),"=",2)
n = Trim(b(0) & "")
If UBound(b) < 1 Then
v = ""
Else
v = b(1)
If InStr(v,"%") > 0 Then v = URLDecode(v)
End If
If n <> "" Then
o_item(n) = v
End If
Next
Set o_regx = Nothing
End Sub
Private Sub Class_Terminate
Set o_item = Nothing
End Sub
'模拟 Request.QueryString
Public Function QueryString()
Set QueryString = o_item
End Function
'模拟 Request.QueryString(n)
Public Function [GET](n)
If o_item.Exists(n) Then
[GET] = o_item.Item(n)
Else
[GET] = ""
End If
End Function
'编码格式化
Private Function URLDecode(ByVal s)
Dim sm,cs,r,o_regex
If Trim(s & "") = "" Then
URLDecode = s : Exit Function
End If
s = unescape(s)
If o_regx.Test(s) Then
cs = "UTF-8"
Else
cs = "GBK"
End If
Set sm = CreateObject("Adodb.Stream")
With sm
.Type = 2
.Mode = 3
.Open
.CharSet = "ISO-8859-1"
.WriteText s
.Position = 0
.CharSet = cs
URLDecode = .ReadText(-1)
.Close
End With
Set sm = Nothing
End Function
End Class
%>
标签:
QueryString,编码
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月16日
2024年11月16日
- 第五街的士高《印度激情版》3CD [WAV+CUE][2.4G]
- 三国志8重制版哪个武将智力高 三国志8重制版智力武将排行一览
- 三国志8重制版哪个武将好 三国志8重制版武将排行一览
- 三国志8重制版武将图像怎么保存 三国志8重制版武将图像设置方法
- 何方.1990-我不是那种人【林杰唱片】【WAV+CUE】
- 张惠妹.1999-妹力新世纪2CD【丰华】【WAV+CUE】
- 邓丽欣.2006-FANTASY【金牌大风】【WAV+CUE】
- 饭制《黑神话》蜘蛛四妹手办
- 《燕云十六声》回应跑路:年内公测版本完成95%
- 网友发现国内版《双城之战》第二季有删减:亲亲环节没了!
- 邓丽君2024-《漫步人生路》头版限量编号MQA-UHQCD[WAV+CUE]
- SergeProkofievplaysProkofiev[Dutton][FLAC+CUE]
- 永恒英文金曲精选4《TheBestOfEverlastingFavouritesVol.4》[WAV+CUE]
- 群星《国风超有戏 第9期》[320K/MP3][13.63MB]
- 群星《国风超有戏 第9期》[FLAC/分轨][72.56MB]