Append vbCrLF to UCS-2 Little Endian

前端 未结 1 741
无人共我
无人共我 2021-01-27 03:41

I\'m using vbscript via HP-UFT (former QTP). I\'m facing with issue which looks pretty simple but I couldn\'t fix it.

I have .CSV files exported from some system and the

相关标签:
1条回答
  • 2021-01-27 04:02

    When in doubt, read the documentation:

    Syntax

    object.OpenTextFile(filename[, iomode[, create[, format]]])

    Arguments

    [...]
    format
    Optional. One of three Tristate values used to indicate the format of the opened file (TristateTrue = -1 to open the file as Unicode, TristateFalse = 0 to open the file as ASCII, TristateUseDefault = -2 to open the file as the system default). If omitted, the file is opened as ASCII.

    You open the file for appending, but don't specify the encoding, so the interpreter assumes ASCII format. Change the line

    Set objFile = objFSO.OpenTextFile(outFile,8)
    

    to

    Set objFile = objFSO.OpenTextFile(outFile, 8, False, -1)
    

    and the problem will disappear.

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