Problem with REXML

Discussion in 'Ruby' started by Jim Kr, May 24, 2007.

  1. Jim Kr

    Jim Kr Guest

    I have a problem when reading out strings from xml documents. The
    problem is that special characters such as åäö comes out wierd. When
    reading these characters from text files the problem doesn't exist. Can
    someone explain whay this is and, if possible, how I can fix it?

    Thanks
    Jim

    --
    Posted via http://www.ruby-forum.com/.
    Jim Kr, May 24, 2007
    #1
    1. Advertising

  2. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    What are the file encodings? Do the text files have a different =20
    encoding than the xml ones?

    George


    On 24 May 2007, at 10:46, Jim Kr wrote:

    >
    > I have a problem when reading out strings from xml documents. The
    > problem is that special characters such as =E5=E4=F6 comes out wierd. =

    When
    > reading these characters from text files the problem doesn't exist. =20=


    > Can
    > someone explain whay this is and, if possible, how I can fix it?
    >
    > Thanks
    > Jim
    >
    > --=20
    > Posted via http://www.ruby-forum.com/.
    >


    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.1 (Darwin)

    iD8DBQFGVWFmuHSlGoVGf7URAq+IAJ0d0BY5jANt7F9ekzsRl0+G2k1eVgCfTdMj
    m242ynUYCnlAXVU5BMuJt64=3D
    =3DzCcu
    -----END PGP SIGNATURE-----
    George Malamidis, May 24, 2007
    #2
    1. Advertising

  3. Jim Kr

    Jim Kr Guest

    George Malamidis wrote:
    > -----BEGIN PGP SIGNED MESSAGE-----
    > Hash: SHA1
    >
    > What are the file encodings? Do the text files have a different
    > encoding than the xml ones?
    >
    > George
    >
    >
    > On 24 May 2007, at 10:46, Jim Kr wrote:
    >
    >> --
    >> Posted via http://www.ruby-forum.com/.
    >>

    >
    > -----BEGIN PGP SIGNATURE-----
    > Version: GnuPG v1.4.1 (Darwin)
    >
    > iD8DBQFGVWFmuHSlGoVGf7URAq+IAJ0d0BY5jANt7F9ekzsRl0+G2k1eVgCfTdMj
    > m242ynUYCnlAXVU5BMuJt64=
    > =zCcu
    > -----END PGP SIGNATURE-----


    The XML file is encoded with ISO-8859-1 while the text files are Windows
    txt files (for which I don't have a clue what encoding they use)

    Jim

    --
    Posted via http://www.ruby-forum.com/.
    Jim Kr, May 24, 2007
    #3
  4. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    It might help if you try saving the files as UTF-8 and then add:

    $KCODE = 'u'
    require 'jcode'

    in your script.

    George


    > The XML file is encoded with ISO-8859-1 while the text files are
    > Windows
    > .txt files (for which I don't have a clue what encoding they use)
    >
    > Jim
    >
    > --
    > Posted via http://www.ruby-forum.com/.
    >


    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.1 (Darwin)

    iD8DBQFGVXU1uHSlGoVGf7URAtSlAJ9yFzLYm79thv4xvqaV3SJKjUhDgQCePpbh
    XfBEVicn9lz1/9o65UkggoM=
    =o5GF
    -----END PGP SIGNATURE-----
    George Malamidis, May 24, 2007
    #4
    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. Damphyr
    Replies:
    2
    Views:
    131
    Damphyr
    Jul 16, 2003
  2. haldane

    REXML problem

    haldane, Jul 6, 2004, in forum: Ruby
    Replies:
    3
    Views:
    85
    Sean Russell
    Jul 8, 2004
  3. Daniel Berger

    rexml error - REXML::Validation

    Daniel Berger, Oct 12, 2004, in forum: Ruby
    Replies:
    2
    Views:
    145
    Henrik Horneber
    Oct 12, 2004
  4. Bart Masschelein

    REXML and new file problem? bug?

    Bart Masschelein, Sep 13, 2005, in forum: Ruby
    Replies:
    1
    Views:
    106
    Zach Dennis
    Sep 13, 2005
  5. Phlip
    Replies:
    0
    Views:
    135
    Phlip
    Jan 15, 2008
Loading...

Share This Page