如何读取UNICODE格式的中英文混合内容的文本文件并正确的显示到控件中。

programfish 2009-02-24 08:38:41
如何读取UNICODE格式的中英文混合内容的文本文件并正确的显示到控件中。
...全文
247 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jxufeng 2009-02-25
  • 打赏
  • 举报
回复
有啊,到vc版上问,除了unicode还有utf-8
zhuweiping2003 2009-02-25
  • 打赏
  • 举报
回复
有用VC写的代码不
Tiger_Zhao 2009-02-24
  • 打赏
  • 举报
回复
Option Explicit

Private Sub Form_Load()
Dim hFile As Integer
Dim iBOM As Integer
Dim bytes() As Byte

hFile = FreeFile()
Open "C:\1.txt" For Binary Access Read As #hFile
Get #hFile, , iBOM
If iBOM <> &HFEFF Then
MsgBox "不是 Unicode 格式文件。", vbExclamation
Close #hFile
Exit Sub
End If

ReDim bytes(LOF(hFile) - 3)
Get #hFile, , bytes
Close #hFile

Text1 = bytes
End Sub
of123 2009-02-24
  • 打赏
  • 举报
回复
text1 = strconv(strdata, vbfromunicode)

7,785

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧