Write text file in appending (utf-8 encoded) in VB6

前端 未结 3 1249
情话喂你
情话喂你 2020-12-10 04:43

I have to write a textfile in VB6. I need to do it in appending and utf-8 encoded.

I tried two solutions, one with \"TextStream\" and another one with \"ADODB.Stream

3条回答
  •  遥遥无期
    2020-12-10 05:04

    I prefer to save it ANSI as it does by default. Open it with a notepad and overwrite it selecting UTF8 encoding. I found it's the fastest way by far. And I use some other code to append, for example for a database convertion:

    Dim fs As Object, a
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set a = fs.CreateTextFile(filename, True) 'example (myfile.xml, True)
    a.writeline var1
    a.writeline var2
    a.Close
    

提交回复
热议问题