+ Reply to Thread
Results 1 to 5 of 5

Open tab separated textfile in UTF-8.

  1. #1
    Hans
    Guest

    Open tab separated textfile in UTF-8.

    Is it possible for Excel (any version) to open a tab separated text file
    saved in UTF-8 encoding? I have big problems showing swedish characters like
    åäö in Excel. If i open the text file in notepad and saves as Unicode (not
    sure what Unicode means here but I guess it is UTF-16...) Excel seems to
    present characters correct.

    Regards
    /Hans



  2. #2
    Colo
    Guest

    Re: Open tab separated textfile in UTF-8.

    Hi Hans, in fact I'm not good at UTF things but I know Excel can export
    UTF.-8 text as an HTML file.
    From the main menu, select Tools > Options > General > Web Options >
    Encoding.
    In Save this document as: combobox, you can select UTF-8.
    After that, select File > SaveAs > Web Page. An html file will be generated
    keeping UTF-8.
    Why don't you open that saved file via IE then SaveAs *.txt?

    Sorry I'm in Japanese environment so I cannot test.

    --
    Regards,
    Colo
    http://www.puremis.net/excel/


    "Hans" <[email protected]> wrote in message
    news:[email protected]...
    > Is it possible for Excel (any version) to open a tab separated text file
    > saved in UTF-8 encoding? I have big problems showing swedish characters

    like
    > $Bjf!&(Bin Excel. If i open the text file in notepad and saves as Unicode (not
    > sure what Unicode means here but I guess it is UTF-16...) Excel seems to
    > present characters correct.
    >
    > Regards
    > /Hans
    >
    >



  3. #3
    Hans
    Guest

    Re: Open tab separated textfile in UTF-8.

    Hi Colo!

    > Why don't you open that saved file via IE then SaveAs *.txt?

    Well this is of course possible but then I can stick to what I have and
    resave the txt file in notepad to Unicode instead of UTF-8. The strange
    thing is that neither word or access have any problems reading the file but
    excel has and I cannot (or at least it is hard) to create my file in UTF-16
    in the first place since it is created in a asp application (com+ component)
    where everything is set up to be utf-8 encoded. I tried to change the
    codepage to utf-16 but IIS told me it was not legal to use this codepage. I
    still think it is strange that Excel cannot read UTF-8 text document.

    Regards
    /Hans



  4. #4
    Colo
    Guest

    Re: Open tab separated textfile in UTF-8.

    Hi Hans,
    So how does this code works in your environment?
    (Please change the path in the following code to the appropriate one.)

    'Need reference to Microsoft ActiveX Data Objects x.x Library
    Sub TestingUTF()
    Dim DataSet(1 To 2) As New ADODB.Stream
    With DataSet(1)
    .Open
    .Charset = "unicode"
    .LoadFromFile "c:\Unicode.txt"
    End With
    With DataSet(2)
    .Open
    .Charset = "utf-8"
    DataSet(1).CopyTo DataSet(2)
    .SaveToFile "C:\utf-8.txt"
    End With
    DataSet(1).Close: DataSet(2).Close
    End Sub


    --
    Regards,
    Colo
    http://www.puremis.net/excel/


    "Hans" <[email protected]> wrote in message
    news:#[email protected]...
    > Hi Colo!
    >
    > > Why don't you open that saved file via IE then SaveAs *.txt?

    > Well this is of course possible but then I can stick to what I have and
    > resave the txt file in notepad to Unicode instead of UTF-8. The strange
    > thing is that neither word or access have any problems reading the file

    but
    > excel has and I cannot (or at least it is hard) to create my file in

    UTF-16
    > in the first place since it is created in a asp application (com+

    component)
    > where everything is set up to be utf-8 encoded. I tried to change the
    > codepage to utf-16 but IIS told me it was not legal to use this codepage.

    I
    > still think it is strange that Excel cannot read UTF-8 text document.
    >
    > Regards
    > /Hans
    >
    >



  5. #5
    Hans
    Guest

    Re: Open tab separated textfile in UTF-8.

    Hi again Colo!

    The export file (tab separated) is cretated from a recordset on the server
    (never stored to disc on server side) and transported to the client via
    response.write (with appropriate content-headers etc). If a script on the
    client should be able to convert the file automatically from utf-8 to
    unicode (utf-16) it must (as far as I understand) either user client side
    vbscript (IE only) or run inside an activeX component. None of these are
    acceptable due to browser support/security issues.

    I was hoping it was possible to get Excel to understand a textfile encoded
    in UTF-8.

    Regards
    /Hans




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1