vbs cannot ope UNICODE txt file?

Discussion in 'Scripting' started by andrea, Nov 11, 2005.

  1. andrea

    andrea Guest

    hello,
    i have some .log file that i want open and read....
    ------------- i know this ---------------------------------------------
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("pippo.log", ForReading)
    strContents = objFile.ReadAll
    objFile.Close
    ------------------------------------------------------------------------

    no problem if txt file is in ASCII mode
    no result if is in UNICODE

    Why?
     
    andrea, Nov 11, 2005
    #1
    1. Advertisements

  2. andrea

    J Ford Guest

    ASCII is default when opening a text file, you need to specify the format if
    it is something else such as UNICODE.

    TristateTrue = Unicode
    TristateFalse = ASCII

    Set objFile = objFSO.OpenTextFile("pippo.log", ForReading, False,
    TristateTrue)
     
    J Ford, Nov 11, 2005
    #2
    1. Advertisements

  3. andrea

    andrea Guest

    don't know if is the same thing but this works:

    Set objFile = objFSO.OpenTextFile("pippo.log" 1, , true)

    thank you all, again :)
     
    andrea, Nov 14, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.