码迷,mamicode.com
首页 > 其他好文 > 详细

UTF-8(bom-non)

时间:2020-02-24 00:06:44      阅读:83      评论:0      收藏:0      [点我收藏+]

标签:creat   set   object   line   ODB   save   pos   adt   overwrite   

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

UTF-8(bom-non)

标签:creat   set   object   line   ODB   save   pos   adt   overwrite   

原文地址:https://www.cnblogs.com/wzhw2015/p/12355032.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!