printing special characters to file

Discussion in 'ASP General' started by shyPotter, Mar 17, 2008.

  1. shyPotter

    shyPotter Guest

    Hi,

    I have some text in non English (e:g Arabic/Urdu/Hindi etc) language. When I
    am using file system object to or normal file system to write that text to
    file I get error, same code with english characters works fine.

    Any idea how to solve this.

    Regards
     
    shyPotter, Mar 17, 2008
    #1
    1. Advertising

  2. "shyPotter" <> wrote in message
    news:...
    > Hi,
    >
    > I have some text in non English (e:g Arabic/Urdu/Hindi etc) language. When

    I
    > am using file system object to or normal file system to write that text to
    > file I get error, same code with english characters works fine.
    >
    > Any idea how to solve this.



    You need to ensure the file is written in unicode format. When using the
    CreateTextFile method make sure you pass a boolean True as the third
    parameter:-

    Dim fso: Set fso = Server.CreateObject("Scripting.FileSystemObject")
    Set oStream = fso.CreateTextFile(sFilePath, True, True)

    This informs the stream to write characters as Unicode.

    What errors were you getting?


    --
    Anthony Jones - MVP ASP/ASP.NET
     
    Anthony Jones, Mar 18, 2008
    #2
    1. Advertising

  3. shyPotter

    shyPotter Guest

    Thanks Anthony , it works

    cheers

    "Anthony Jones" <> wrote in message
    news:...
    > "shyPotter" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> I have some text in non English (e:g Arabic/Urdu/Hindi etc) language.
    >> When

    > I
    >> am using file system object to or normal file system to write that text
    >> to
    >> file I get error, same code with english characters works fine.
    >>
    >> Any idea how to solve this.

    >
    >
    > You need to ensure the file is written in unicode format. When using the
    > CreateTextFile method make sure you pass a boolean True as the third
    > parameter:-
    >
    > Dim fso: Set fso = Server.CreateObject("Scripting.FileSystemObject")
    > Set oStream = fso.CreateTextFile(sFilePath, True, True)
    >
    > This informs the stream to write characters as Unicode.
    >
    > What errors were you getting?
    >
    >
    > --
    > Anthony Jones - MVP ASP/ASP.NET
    >
    >
     
    shyPotter, Mar 19, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jonfogh
    Replies:
    2
    Views:
    365
    jonfogh
    Jan 5, 2006
  2. Stefan Mueller
    Replies:
    3
    Views:
    33,050
    Stefan Mueller
    Jul 23, 2006
  3. Replies:
    2
    Views:
    1,097
    Ingo Menger
    May 31, 2007
  4. rvino
    Replies:
    0
    Views:
    4,664
    rvino
    Aug 14, 2007
  5. majna
    Replies:
    4
    Views:
    678
    Thomas 'PointedEars' Lahn
    Sep 19, 2007
Loading...

Share This Page