国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

轉(zhuǎn)換中文為unicode 轉(zhuǎn)換unicode到正常文本

2020-07-27 13:26:16
字體:
供稿:網(wǎng)友

復(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(o,url)

    dim oReq

    on error resume next

    if o is nothing then
        '//創(chuàng)建XMLHTTP對象
        set oReq    = CreateObject("MSXML2.XMLHTTP")
    else
        set oReq    = o 
    end if

        oReq.open "get",url,false
        oReq.send 

    if oReq.status = 200 or oReq.status = 0 then    
        getText = bytes2BSTR(oReq.responseBody)
    else
        getText = ""
    end if

end function

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 青田县| 湘乡市| 武义县| 晋中市| 紫金县| 光山县| 星子县| 南郑县| 宜都市| 紫阳县| 太仆寺旗| 松江区| 三河市| 桦川县| 安溪县| 高要市| 奉贤区| 崇左市| 淅川县| 杭锦旗| 宣汉县| 西城区| 文登市| 乌兰察布市| 嘉黎县| 建德市| 醴陵市| 石棉县| 兴安县| 南宫市| 莆田市| 福清市| 台南市| 阿瓦提县| 新干县| 吕梁市| 永春县| 罗源县| 通河县| 江西省| 黔西|