| Satchi 2004-02-29, 8:34 pm |
| I have to do an application who will download asp pages in japaneese,
chinese, english... and save datas in an UTF-8 file.
I search on the web and they speak about the adodb.stream method who
is able to change the encoding.
Code :
<%@ language=vbscript enablesessionstate=false CodePage=65001%>
<%
sFile = server.mappath("canon.htm")
sFile2 = server.mappath("canon2.htm")
sURL = "http://www.canon.ru/"
'Download of the page
Set objXMLHTTP = server.CreateObject("MSXML2.serverXMLHTTP")
objXMLHTTP.Open "GET", sURL, False
objXMLHTTP.Send
'Write the file number 1 without modification (binary powered)
set file1 = server.CreateObject("ADODB.Stream")
file1.type = 1
file1.open
file1.write objXMLHTTP.responseBody
file1.savetofile sFile, 2
file1.close
set file1 = nothing
'Write the file number 2 with encoding modification (UTF-8)
Set file2 = server.CreateObject("ADODB.Stream")
file2.Open
file2.LoadFromFile sfile
file2.Charset = "UTF-8"
file2.SaveToFile sFile2, 2
file2.Close
set file2 = nothing
%>
I was thinking that it will translate the file number 2 into UTF8 but
it doesn't work : when i try to open the file number 2 in unicode mode
it doesn't work, i still must open the page in cyrillic mode.
How can i have in the file number 2 a pure UTF-8 file who can be read
from an unicode text editor ?
|