How to handle unicode data in ActiveX script!!

  • Hi,

    I am writing a ActiveX script to extract data from a LotusNotes database and realised some of the fields contain chinese characters because of which when i am writing data string to a flat file it gives an error " invalid Procedure call or augument".

     I have to extract data to a flat file.

    Any help will be highly appreciated.

    Thanks

    SUmit

  • You could try using the FileSystemObject to open a text file for Unicode writing using the Tristate switch in the OpenTextFile method.

    Function Main

     Dim fso

     Dim fol

     Dim f, sFilename

     Dim ts

     

     Const ForReading = 1, ForWriting = 2, ForAppending = 8

     Const TristateDefault = -2, TristateTrue_Unicode = -1, TristateFalse_ASCII = 0

     

     sFilename = "C:\Test.txt"

     

     Set fso = CreateObject("Scripting.FileSystemObject")

     

     ' Create File and then deallocate f as file needs opening for unicode writing

     Set f = fso.CreateTextFile(sFilename, True)

     Set f= nothing

     

     Set ts = fso.OpenTextFile(sFilename, ForWriting, TristateTrue_Unicode)

     

     'Insert looping for all data lines to be written ---- Fetch > Write

     

     'End Loop

     

     ts.Close

     Set ts = Nothing

     Set fso = Nothing

     

     

    End Function



    Ade

    A Freudian Slip is when you say one thing and mean your mother.
    For detail-enriched answers, ask detail-enriched questions...[/url]

  • cool..i ll try this now..thanks alot..

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply