轉(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)文章
從零開(kāi)始 教你如何搭建Discuz!4.1論壇(圖)
從零開(kāi)始 教你如何搭建Discuz!4.1論壇(圖)...2006-07-07php計(jì)數(shù)器的設(shè)計(jì)與實(shí)現(xiàn)
php計(jì)數(shù)器的設(shè)計(jì)與實(shí)現(xiàn)...2006-07-07解決控件遮擋問(wèn)題:關(guān)于有窗口元素和無(wú)窗口元素
解決控件遮擋問(wèn)題:關(guān)于有窗口元素和無(wú)窗口元素...2007-01-01最令PHP初學(xué)者頭痛的十四個(gè)問(wèn)題
最令PHP初學(xué)者頭痛的十四個(gè)問(wèn)題...2006-07-07JavaScript與HTML結(jié)合的基本使用方法整理
這篇文章主要介紹了JavaScript與HTML結(jié)合的基本使用方法整理,是JavaScript入門學(xué)習(xí)中的基礎(chǔ)知識(shí),需要的朋友可以參考下2015-10-10