Public Sub WriteUTF_8BomNon(ByVal fileName As String, ByVal strLine As String)
Dim stream: Set stream = CreateObject("ADODB.Stream")
stream.Type = 2 ' adTypeText
stream.Charset = "UTF-8"
stream.Open
stream.writeText strLine
stream.Position = 0
stream.Type = 1 ' adTypeBinary
stream.Position = 3
Dim bin: bin = stream.Read()
stream.Close
Dim restream: Set restream = CreateObject("ADODB.Stream")
restream.Type = 1 ' dTypeBinary
restream.Open
restream.Write bin
restream.SaveToFile fileName, 2 ' force overwrite
restream.Close
End Sub
人生不断地重复着一次一次的问题,把这些问题记录下来,让自己和有需要的人省点时间。