UTF-8(bom-non)
Posted wzhw2015
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了UTF-8(bom-non)相关的知识,希望对你有一定的参考价值。
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)的主要内容,如果未能解决你的问题,请参考以下文章
如何将 utf-8 字节偏移量转换为 utf-8 字符偏移量
在 Python 中将带 BOM 的 UTF-8 转换为不带 BOM 的 UTF-8