how to create a textfile with UTF-8 encoding through vbscript?

前端 未结 1 1593
礼貌的吻别
礼貌的吻别 2021-01-23 12:04

I have written the following code segment:

strVar = \"one line that I want to write in the text file with extension .csv\"
\'Set fso = CreateObject(\"Scripting.F         


        
相关标签:
1条回答
  • 2021-01-23 12:39

    If you want to append to a file, simply open the file for appending:

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile("C:\path\to\your.csv", 8, True)
    f.WriteLine "text to append"
    f.Close
    

    You also don't need to use CreateTextFile() first. The 3rd parameter of OpenTextFile() already takes care of that.

    As far as printable characters are concerned, there is no difference between ISO-8859-1 and what Microsoft calls "ANSI" in textfiles.

    0 讨论(0)
提交回复
热议问题