VB怎么把ANSI编码的txt文件转为UTF-8编码?

VB怎么把ANSI编码的txt文件转为UTF-8编码?
点击窗体上的command1自动把C:\1.txt转为UTF-8的文本。
之前用过很多代码,得出的都是乱码。
对了,是不包含签名的UTF-8。

谢谢。

第1个回答  2011-11-06
charset设置为utf-8即可

Function BytesToBstr(body, charset)
Dim objstream
Set objstream = CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode = 3
objstream.Open
On Error Resume Next
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.charset = charset
BytesToBstr = objstream.ReadText
objstream.Close
Set objstream = Nothing
End Function追问

好像不是针对文件而是针对字符串的,呃

第2个回答  2011-11-06
0122444444
相似回答