Turn: http://www.cnblogs.com/waver/articles/1283842.html
================================== VB Code ======== ======================================
Public Function SaveFile (filename as variant, strfilebody as variant) as Boolean
Dim ado_stream as object
Set ado_stream = Createobject ("ADODB. Stream ")
With ado_stream
. Type = 2
. Mode = 3
. Charset = "UTF-8"
. Open
. Writetext strfilebody
. Savetofile filename, 2
End
SaveFile = true
Set ado_stream = nothing
End Function
Public Function readutf8 (byval suf8file as string) as string
If Len (suttf8file) = 0 or Dir (suttf8file) = vbnullstring then exit function
Dim Ados as object
Set Ados = Createobject ("ADODB. Stream ")
With Ados
. Charset = "UTF-8"
. Type = 2
. Open
. Loadfromfile suf8file
Readutf8 =. readtext
. Close
End
Set Ados = nothing
End Function
================================ VBScript code ======== ======================================
Function LoadFile (PATH)
Dim stm2
Set stm2 = Createobject ("ADODB. Stream ")
Optional 2.type = 2
Listen 2.mode = 3
Ipv2.open
Ipv2.loadfromfile path
Listen 2.charset = "UTF-8"
'Stm2. charset = "Unicode"
'Stm2. charset = "gb2312"
Limit 2.position = 0
LoadFile = pai2.readtext
Commit 2.close
Set stm2 = nothing
End Function
Function writetofile (file, message)
Dim stm1
Set stm1 = Createobject ("ADODB. Stream ")
Required 1.type = 2
Secrets 1.open
Character 1.charset = "UTF-8"
'Stm1. charset = "Unicode"
Snapshot 1.position = snapshot 1.size
Upload 1.writetext LoadFile (File) + vbcrlf + message
Secrets 1.savetofile file, 2
Statement 1.close
Set stm1 = nothing
End Function