Convert Chinese to Unicode to normal text

Source: Internet
Author: User

CopyCode The Code is as follows: '// convert Chinese to 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

'// Convert Unicode to normal text
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
'// Create an XMLHTTP object
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.