VB笔记

VB读取utf-8文档

Public Function ReadUTF8(ByVal sUTF8File As String) As String
 If Len(sUTF8File) = 0 Or Dir(sUTF8File) = vbNullString Then Exit Function
 Dim ados As Object
 Set ados = CreateObject("adodb.stream")
 With ados
     .Charset = "utf-8"
     .Type = 2
     .Open
     .LoadFromFile sUTF8File
     ReadUTF8 = .ReadText
     .Close
 End With
 Set ados = Nothing
End Function

你可能感兴趣的:(VB笔记)