UTF-8 -> iso8859-15

Discussion in 'Ruby' started by Andreas Schwarz, Jul 25, 2003.

  1. Simple Question: how can I convert UTF-8 strings (from REXML) to
    iso8859-15?

    Thanks
    Andreas

    --
    AVR-Tutorial, über 350 Links
    Forum für AVRGCC und MSPGCC
    -> http://www.mikrocontroller.net
    Andreas Schwarz, Jul 25, 2003
    #1
    1. Advertising

  2. Andreas Schwarz

    Mark J. Reed Guest

    On Fri, Jul 25, 2003 at 08:32:20PM +0000, Andreas Schwarz wrote:
    > Simple Question: how can I convert UTF-8 strings (from REXML) to
    > iso8859-15?


    You would think that was a simple question, but I don't have a simple
    answer. The YAML homepage mentions a Ruby interface to the Iconv
    library, but the link it provides back to RAA doesn't find anything.
    Was there an Iconv library that disappeared??

    -Mark
    Mark J. Reed, Jul 29, 2003
    #2
    1. Advertising

  3. Andreas Schwarz

    daz Guest

    "Mark J. Reed" <> wrote:

    > On Fri, Jul 25, 2003 at 08:32:20PM +0000, Andreas Schwarz wrote:
    > > Simple Question: how can I convert UTF-8 strings (from REXML) to
    > > iso8859-15?

    >
    > You would think that was a simple question, but I don't have a simple
    > answer. The YAML homepage mentions a Ruby interface to the Iconv
    > library, but the link it provides back to RAA doesn't find anything.
    > Was there an Iconv library that disappeared??
    >
    > -Mark


    http://ruby-talk.org/76747

    ?
    daz, Jul 29, 2003
    #3
  4. Andreas Schwarz

    Mark J. Reed Guest

    AS = Andreas Schwarz
    MR = me
    D = daz

    AS> Simple Question: how can I convert UTF-8 strings (from REXML) to
    AS> iso8859-15?

    MR> You would think that was a simple question, but I don't have a simple
    MR> answer. The YAML homepage mentions a Ruby interface to the Iconv
    MR> library, but the link it provides back to RAA doesn't find anything.
    MR> Was there an Iconv library that disappeared??

    D> http://ruby-talk.org/76747
    D> ?

    Thanks, but that doesn't help in this case. The referenced message
    includes a pointer to a port of libiconv to Windows, but libiconv I
    already have. What I don't have is the code to use it from Ruby.
    I could write an extension, but what confused me was the reference on
    the YAML page. It seemed to imply that this had already been done, and
    even had a link that should have taken me to the Ruby module
    on RAA, but no such module was there.

    -Mark
    Mark J. Reed, Jul 29, 2003
    #4
  5. Mark J. Reed () wrote:
    >
    > I could write an extension, but what confused me was the reference on
    > the YAML page. It seemed to imply that this had already been done, and
    > even had a link that should have taken me to the Ruby module
    > on RAA, but no such module was there.
    >


    Oh, sorry. I need to remove that link. The iconv lib is now included
    with 1.8.0. WrItten by Nobu. If you need it for 1.6.8, I found the
    link from FreeBSD ports (/usr/ports/converters/ruby-iconv):

    http://member.nifty.ne.jp/nokada/archive/iconv-0.5.tar.gz

    Also, please note that YAML 0.50 or newer don't utilize iconv for
    conversion and in fact doesn't do any character set conversion.

    _why
    why the lucky stiff, Jul 30, 2003
    #5
  6. Andreas Schwarz

    Guest

    , Jul 30, 2003
    #6
  7. Andreas Schwarz

    Mark J. Reed Guest

    > At Wed, 30 Jul 2003 12:12:37 +0900,
    > why the lucky stiff wrote:
    > > The iconv lib is now included with 1.8.0


    Oh! Well, in that case, the answer to the original question is simple.

    require 'iconv'
    iconv = Iconv.new('ISO-8859-15', 'UTF-8')
    latin9text = iconv.iconv(utf8text)

    I find the (to, from) argument order counterintuitive, but that's not Nobu's
    fault - it's the order of the underlying C function iconv_open.

    -Mark
    Mark J. Reed, Jul 31, 2003
    #7
  8. Andreas Schwarz

    Guest

    Hi,

    At Thu, 31 Jul 2003 12:36:32 +0900,
    Mark J. Reed wrote:
    > I find the (to, from) argument order counterintuitive, but that's not Nobu's
    > fault - it's the order of the underlying C function iconv_open.


    Agree. I often miss it too.

    --
    Nobu Nakada
    , Jul 31, 2003
    #8
    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. JJBW
    Replies:
    1
    Views:
    10,005
    Joerg Jooss
    Apr 24, 2004
  2. =?Utf-8?B?QXNoYQ==?=
    Replies:
    3
    Views:
    409
  3. moonhkt

    change ISO8859-1 to GB2312

    moonhkt, May 19, 2010, in forum: Java
    Replies:
    17
    Views:
    1,597
    RedGrittyBrick
    May 26, 2010
  4. polo

    iso8859-1 and utf-8

    polo, Dec 31, 2003, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    158
    Jan Tielens
    Jan 2, 2004
  5. Hadmut Danisch

    Conversion between utf-8 and iso8859-1?

    Hadmut Danisch, Feb 13, 2004, in forum: Ruby
    Replies:
    3
    Views:
    222
    Carlos
    Feb 16, 2004
Loading...

Share This Page