urluft8.asp
资源名称:wap.rar [点击查看]
上传用户:sking1122
上传日期:2020-09-24
资源大小:1005k
文件大小:3k
源码类别:
手机WAP编程
开发平台:
ASP/ASPX
- <%
- Function UTF2GB(UTFStr)
- Dim Dig
- Dim GBStr
- For Dig = 1 To Len(UTFStr)
- If Mid(UTFStr, Dig, 1) = "%" Then
- If Len(UTFStr) >= Dig + 8 Then
- GBStr = GBStr & ConvChinese(Mid(UTFStr, Dig, 9))
- Dig = Dig + 8
- Else
- GBStr = GBStr & Mid(UTFStr, Dig, 1)
- End If
- Else
- GBStr = GBStr & Mid(UTFStr, Dig, 1)
- End If
- Next
- UTF2GB = GBStr
- End Function
- '======================================================================================================================================================
- 'UTF8编码文字将转换为汉字
- Function ConvChinese(x)
- Dim A,i,j
- A = Split(Mid(x, 2), "%")
- i = 0
- j = 0
- For i = 0 To Ubound(A)
- A(i) = C16To2(A(i))
- Next
- For i = 0 To Ubound(A) - 1
- DigS = Instr(A(i), "0")
- Unicode = ""
- For j = 1 To DigS - 1
- If j = 1 Then
- A(i) = Right(A(i), Len(A(i)) - DigS)
- Unicode = Unicode & A(i)
- Else
- i = i + 1
- A(i) = Right(A(i), Len(A(i)) - 2)
- Unicode = Unicode & A(i)
- End If
- Next
- If Len(C2To16(Unicode)) = 4 Then
- ConvChinese = ConvChinese & Chrw(Int("&H" & C2To16(Unicode)))
- Else
- ConvChinese = ConvChinese & Chr(Int("&H" & C2To16(Unicode)))
- End If
- Next
- End Function
- '======================================================================================================================================================
- '二进制代码转换为十六进制代码
- Function C2To16(x)
- i = 1
- For i = 1 To Len(x) Step 4
- C2To16 = C2To16 & Hex(C2To10(mid(x, i, 4)))
- Next
- End Function
- '======================================================================================================================================================
- '二进制代码转换为十进制代码
- Function C2To10(x)
- C2To10 = 0
- If x="0" Then
- Exit Function
- End If
- i = 0
- For i = 0 To Len(x) - 1
- If Mid(x, Len(x) - i, 1) = "1" Then
- C2To10 = C2To10+2^(i)
- End If
- Next
- End Function
- '======================================================================================================================================================
- '十六进制代码转换为二进制代码
- Function C16To2(x)
- Dim Tempstr
- i = 0
- For i = 1 To Len(Trim(x))
- Tempstr = C10To2(Cint(Int("&h" & Mid(x, i, 1))))
- Do While Len(tempstr) < 4
- tempstr = "0" & tempstr
- Loop
- C16To2 = C16To2 & tempstr
- Next
- End Function
- '======================================================================================================================================================
- '十进制代码转换为二进制代码
- Function C10To2(x)
- Dim mysign,DigS,tempnum
- mysign = Sgn(x)
- x = Abs(x)
- DigS = 1
- Do
- if x<2^DigS then
- Exit Do
- Else
- DigS = DigS + 1
- End If
- Loop
- tempnum = x
- i = 0
- For i = DigS To 1 step - 1
- If tempnum>=2^(i-1) Then
- tempnum = tempnum-2^(i-1)
- C10To2 = C10To2 & "1"
- Else
- C10To2 = C10To2 & "0"
- End If
- Next
- If mysign=-1 Then
- C10To2="-" & C10To2
- End If
- End Function
- %><%
- '====================================================================
- ' 请你保留这段说明,这并不会影响你的速度. 电脑交流:http://www.cnscu.cn
- ' 程序制作:横云 掌上校园收倾心整理收集于互联网,感谢你的支持!
- ' 升级时间: 2008-2-5 主页地址:HTTP://wap.cnscu.cn
- ' E-Mail: cnscu@126.com 客服QQ:554904632 QQ群:30493504 QQ群2:46659883
- '====================================================================
- %>