轉(zhuǎn)換中文為unicode 轉(zhuǎn)換unicode到正常文本
更新時(shí)間:2006年09月01日 00:00:00 作者:
復(fù)制代碼 代碼如下:
'//轉(zhuǎn)換中文為unicode
function URLEncoding(vstrIn)
dim i
dim strReturn,ThisChr,innerCode,Hight8,Low8
strReturn = ""
for i = 1 to Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
If Abs(Asc(ThisChr)) < &HFF then
strReturn = strReturn & ThisChr
else
innerCode = Asc(ThisChr)
If innerCode < 0 then
innerCode = innerCode + &H10000
end If
Hight8 = (innerCode and &HFF00)\ &HFF
Low8 = innerCode and &HFF
strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
end If
next
URLEncoding = strReturn
end function
'//轉(zhuǎn)換unicode到正常文本
function bytes2BSTR(vIn)
dim i
dim strReturn,ThisCharCode,nextCharCode
strReturn = ""
for i = 1 to LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 then
strReturn = strReturn & Chr(ThisCharCode)
else
nextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(nextCharCode))
i = i + 1
end If
next
bytes2BSTR = strReturn
end function
function getText(oReq,url)
on error resume next
'//創(chuàng)建XMLHTTP對(duì)象
if oReq is nothing then
set oReq = CreateObject("MSXML2.XMLHTTP")
end if
if not oReq is nothing then
oReq.open "get",url,false
oReq.send
if oReq.status = 200 then
getText = bytes2BSTR(oReq.responseBody)
else
getText = ""
end if
else
getText = ""
end if
end function
相關(guān)文章
jQuery EasyUI API 中文文檔 - DateBox日期框
jQuery EasyUI API 中文文檔 - DateBox日期框,需要的朋友可以參考下。2011-10-10
php計(jì)數(shù)器的設(shè)計(jì)與實(shí)現(xiàn)
php計(jì)數(shù)器的設(shè)計(jì)與實(shí)現(xiàn)...2006-07-07
php網(wǎng)絡(luò)安全session利用的小思路
這篇文章主要為大家介紹了關(guān)于php網(wǎng)絡(luò)安全中session利用的小思路示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步2022-02-02
eval(cmd)與eval($cmd)的區(qū)別與聯(lián)系
這篇文章主要介紹了eval(cmd)與eval($cmd)的區(qū)別與聯(lián)系,希望對(duì)屏幕前的你有所幫助2021-07-07
微信開發(fā)之php表單微信中自動(dòng)提交兩次問(wèn)題解決辦法
這篇文章主要介紹了微信開發(fā)之php表單微信中自動(dòng)提交兩次問(wèn)題解決辦法的相關(guān)資料,這里提供了解決辦法及實(shí)例代碼,需要的朋友可以參考下2017-01-01
JavaScript與HTML結(jié)合的基本使用方法整理
這篇文章主要介紹了JavaScript與HTML結(jié)合的基本使用方法整理,是JavaScript入門學(xué)習(xí)中的基礎(chǔ)知識(shí),需要的朋友可以參考下2015-10-10

