Website simple traditional conversion function

Source: Internet
Author: User
1.gb.asp
<%
' Get the server-generated HTML code
Function gethttppage (URL)
Dim XmlHttp
Set Xmlhttp=server.createobject ("Microsoft.XMLHTTP")
Xmlhttp.open "Get", Url,false
Xmlhttp.send ()
' Gethttppage=http.responsetext
If Xmlhttp.readystate<>4 then Exit function
Gethttppage=bytes2bstr (Xmlhttp.responsebody)
Set xmlhttp=nothing
If Err.number<>0 then err. Clear
End Function
Function Bytes2bstr (VIN)
Dim Bytesstream,stringreturn
Set Bytesstream = Server.CreateObject ("ADODB. Stream ")
Bytesstream.type = 2
Bytesstream.open
Bytesstream.writetext Vin
bytesstream.position = 0
Bytesstream.charset = "GB2312"
Bytesstream.position = 2
Stringreturn =bytesstream.readtext
Bytesstream.close
Set Bytesstream = Nothing
Bytes2bstr = Stringreturn
End Function
' The page-delimited output function in the transformation function
Sub Splitwords (words)
Into=words
Out= ""
"Response.Write" Total Words: "&len (Into) &" <br> "
For I=1 to Len loops through each character
' Response.Write ' now loops "&i&"/"&len (INTO) &" times, and begins to detect characters "&mid (into,i,1) &" <br> "
If AscW (Mid (into,i,1)) <0 or AscW (Mid (into,i,1)) >255 then ' if it is Simplified Chinese, enter the detection phase
CODE=INSTR (Application ("GB"), Mid (into,i,1)) ' Gets the position of this character in a simplified library
If code then ' if present in Simplified Chinese library
Out=out&mid (Application ("Other_language"), code,1) ' outputs the corresponding traditional characters in the traditional font
' Response.Write ' now outputs the traditional "&i&" characters: "&mid" (Application ("Other_language"), i,1) & "<br>"
Else
Out=out&mid (into,i,1) ' is output
' Response.Write ' now outputs the simplified &i& ' characters ' &mid (into,i,1) & "<br>"
Related Article

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.