我有一个保存为 UTF-8 的文本文件,当我尝试读取该文件时,它给了我奇怪的字符而不是正确的字符(它包含中文字符)。我怎样才能让它给我正确的汉字?
Option Explicit
Dim objFSO, strTextFile, strData, strLine, arrLines, aniTextFile, aniData, aniLines, aniLine, objTextFile, fso, inputFileList, listFile, fname
Dim iim1, iret, iret2, iret3, i
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
strTextFile = "C:\Users\admin\Desktop\ArtistCG\folder.txt"
strData = objFSO.OpenTextFile(strTextFile,ForReading).ReadAll
arrLines = Split(strData,vbCrLf)
aniTextFile = "C:\Users\admin\Desktop\ArtistCG\folder-list.txt"
aniData = objFSO.OpenTextFile(aniTextFile,ForReading).ReadAll
aniLines = Split(aniData,vbCrLf)
For i = 0 To UBound(arrLines)
strData = objFSO.OpenTextFile(arrLines(i),ForReading).ReadAll
WScript.Echo strData
Set listFile = objFSO.OpenTextFile(aniLines(i),ForReading)
Do While Not listFile.AtEndOfStream
fName = listFile.ReadLine
WScript.Echo fName
Loop
listFile.Close
Next