Conversion between utf-8 and iso8859-1?

Discussion in 'Ruby' started by Hadmut Danisch, Feb 13, 2004.

  1. Hi,

    I need to convert between different character sets,
    but didn't find any library to do so except for
    ruby-gnome's glib.convert

    Is there any character conversion library which
    doesn't come with a complete graphical library?

    regards
    Hadmut
     
    Hadmut Danisch, Feb 13, 2004
    #1
    1. Advertising

  2. Hadmut Danisch

    MikkelFJ Guest

    "Hadmut Danisch" <> skrev i en meddelelse
    news:c0j99t$t9p$04$-online.com...
    > Hi,
    >
    > I need to convert between different character sets,
    > but didn't find any library to do so except for
    > ruby-gnome's glib.convert
    >
    > Is there any character conversion library which
    > doesn't come with a complete graphical library?


    I'm not aware of any but that isn't to say there isn't one :)
    I assume you have checked out "iconv" which I have no experience with.

    There is a good code page tutorial here - follow a few links if you need.

    http://www.cs.tut.fi/~jkorpela/chars.html

    The utf-8 format is easily decomposed into UCS2, and from there it is fairly
    easy to go to 8859-1 because it is only 256 characters and most of them are
    in the lower 8 bytes of UCS2.
    You should btw. also consider 8859-9 (I think it is) it's basically 8859-1
    with the euro sign.

    Mikkel
     
    MikkelFJ, Feb 14, 2004
    #2
    1. Advertising

  3. Hadmut Danisch

    Aredridel Guest

    > > I need to convert between different character sets,
    > > but didn't find any library to do so except for
    > > ruby-gnome's glib.convert
    > >
    > > Is there any character conversion library which
    > > doesn't come with a complete graphical library?

    >
    > I'm not aware of any but that isn't to say there isn't one :)
    > I assume you have checked out "iconv" which I have no experience with.


    iconv sounds like the tool to me.

    > You should btw. also consider 8859-9 (I think it is) it's basically 8859-1
    > with the euro sign.


    ISO-8859-15, which has updated french and German characters, and the
    Euro. -9 is non-roman.

    Ari
     
    Aredridel, Feb 14, 2004
    #3
  4. Hadmut Danisch

    Carlos Guest

    > Hi,
    >
    > I need to convert between different character sets,
    > but didn't find any library to do so except for
    > ruby-gnome's glib.convert
    >
    > Is there any character conversion library which
    > doesn't come with a complete graphical library?


    Between these two encodings, you can use, without any external library:

    utf8string.unpack("U*").pack("c*") # => latin1 string

    latin1string.unpack("C*").pack("U*") # => utf8 string
     
    Carlos, Feb 16, 2004
    #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. Arifi Koseoglu
    Replies:
    2
    Views:
    985
    Arifi Koseoglu
    Apr 13, 2004
  2. moonhkt

    change ISO8859-1 to GB2312

    moonhkt, May 19, 2010, in forum: Java
    Replies:
    17
    Views:
    1,663
    RedGrittyBrick
    May 26, 2010
  3. jmfauth
    Replies:
    4
    Views:
    324
    jmfauth
    Oct 13, 2010
  4. polo

    iso8859-1 and utf-8

    polo, Dec 31, 2003, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    169
    Jan Tielens
    Jan 2, 2004
  5. Andreas Schwarz

    UTF-8 -> iso8859-15

    Andreas Schwarz, Jul 25, 2003, in forum: Ruby
    Replies:
    7
    Views:
    106
Loading...

Share This Page