Iconv.iconv and Windows XP

Discussion in 'Ruby' started by Tim Ferrell, Oct 2, 2005.

  1. Tim Ferrell

    Tim Ferrell Guest

    I am trying to use the ruby-mp3info library on Windows XP and all is well unless
    the tags have some Unicode in them. I installed GNU libiconv 1.9.1 and the
    iconv.so file using the instructions found here:

    http://wiki.rubyonrails.com/rails/pages/iconv

    I get an exception, though, when I try using it. Here is the relevant code and
    the error:

    require "iconv"

    #strip byte-order bytes if they exists
    data[0..3] =~ /^[\xff\xfe]+$/ and data = data[2..-1]

    data = Iconv.iconv("ISO-8859-1", "UNICODE", data)[0]

    --

    #<Errno::ENOENT: No such file or directory - iconv("ISO-8859-1", "UNICODE")>

    I am totally lost on this ... any ideas? Also is there any kind of alternative
    to iconv on Windows?

    Thanks,
    Tim
     
    Tim Ferrell, Oct 2, 2005
    #1
    1. Advertising

  2. Tim Ferrell

    Dave Burt Guest

    Tim Ferrell wrote:
    > data = Iconv.iconv("ISO-8859-1", "UNICODE", data)[0]
    >
    > #<Errno::ENOENT: No such file or directory - iconv("ISO-8859-1",
    > "UNICODE")>
    >
    > I am totally lost on this ... any ideas?


    Your iconv install is working fine. Did you use my installer?

    The library (which is written in C, so that's its excuse) throws the C error
    ENOENT, which is a generic error meaning "file not found," when you feed it
    an encoding name it doesn't know about. "Unicode" is one of those encoding
    names.

    I'm not sure exactly what you're after here, but (from
    http://www.unicode.org/glossary) "There are seven character encoding schemes
    in Unicode: UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, and
    UTF-32LE." There are also UCS-2 (and UCS-2BE and UCS-2LE, relatively common)
    and UCS-4, which are all different encoding schemas.

    You probably want "UTF-8". It's popular.

    > Also is there any kind of alternative to iconv on Windows?


    I'm not aware of anything better supported in Ruby. There is another lib
    that I've forgotten the name of. So I would say, "no." No.

    Cheers,
    Dave
     
    Dave Burt, Oct 3, 2005
    #2
    1. Advertising

  3. Tim Ferrell

    Tim Guest

    Thanks much for the reply ... I picked up the lib in question (mp3info)
    from RAA and and am somewhat unfamiliar with the code but your point
    makes perfect sense, now that you mention it :)

    I'll change "UNICODE" to "UTF-8" and see where that gets me ... if it
    works I'll contact the original author with a patch that also will
    include some small fixes I've added along the way.

    Thanks much!
    Tim

    Dave Burt wrote:
    > Tim Ferrell wrote:
    >
    >> data = Iconv.iconv("ISO-8859-1", "UNICODE", data)[0]
    >>
    >>#<Errno::ENOENT: No such file or directory - iconv("ISO-8859-1",
    >>"UNICODE")>
    >>
    >>I am totally lost on this ... any ideas?

    >
    >
    > Your iconv install is working fine. Did you use my installer?
    >
    > The library (which is written in C, so that's its excuse) throws the C error
    > ENOENT, which is a generic error meaning "file not found," when you feed it
    > an encoding name it doesn't know about. "Unicode" is one of those encoding
    > names.
    >
    > I'm not sure exactly what you're after here, but (from
    > http://www.unicode.org/glossary) "There are seven character encoding schemes
    > in Unicode: UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, and
    > UTF-32LE." There are also UCS-2 (and UCS-2BE and UCS-2LE, relatively common)
    > and UCS-4, which are all different encoding schemas.
    >
    > You probably want "UTF-8". It's popular.
    >
    >
    >>Also is there any kind of alternative to iconv on Windows?

    >
    >
    > I'm not aware of anything better supported in Ruby. There is another lib
    > that I've forgotten the name of. So I would say, "no." No.
    >
    > Cheers,
    > Dave
    >
    >
    >
     
    Tim, Oct 3, 2005
    #3
  4. Tim Ferrell

    Dave Burt Guest

    iconv aliases? (Re: Iconv.iconv and Windows XP)

    Tim wrote:
    > I'll change "UNICODE" to "UTF-8" and see where that gets me ... if it
    > works I'll contact the original author with a patch that also will include
    > some small fixes I've added along the way.


    An interesting thing I didn't put down in response to your original post is
    that in past experience with command-line iconv, it dealt with aliases.
    "Latin-1" is one I'm certain existed, and I believe "Unicode" was mapped to
    "UTF-16" or something. I'm not sure where those aliases are, and why this
    iconv/Ruby setup doesn't have them.

    Cheers,
    Dave
     
    Dave Burt, Oct 4, 2005
    #4
  5. Re: iconv aliases? (Re: Iconv.iconv and Windows XP)

    Hi

    At Tue, 4 Oct 2005 12:21:49 +0900,
    Dave Burt wrote in [ruby-talk:158928]:
    > An interesting thing I didn't put down in response to your original post is
    > that in past experience with command-line iconv, it dealt with aliases.
    > "Latin-1" is one I'm certain existed, and I believe "Unicode" was mapped to
    > "UTF-16" or something. I'm not sure where those aliases are, and why this
    > iconv/Ruby setup doesn't have them.


    It needs config.charset[1] file, and does nothing for Windows.

    [1]: http://www.ctan.org/tex-archive/macros/texinfo/texinfo/intl/config.charset

    --
    Nobu Nakada
     
    nobuyoshi nakada, Oct 4, 2005
    #5
    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. Thomas Leitner

    iconv replacement for windows?

    Thomas Leitner, Dec 10, 2004, in forum: Ruby
    Replies:
    17
    Views:
    737
  2. Wilson Bilkovich

    Iconv weirdness on Windows XP

    Wilson Bilkovich, Dec 13, 2005, in forum: Ruby
    Replies:
    13
    Views:
    282
    Wilson Bilkovich
    Dec 14, 2005
  3. Phil Duby

    ruby, GTK and iconv.dll

    Phil Duby, Feb 6, 2006, in forum: Ruby
    Replies:
    1
    Views:
    129
    steve messamore
    Feb 25, 2006
  4. Stefan Schmiedl

    ruby, irb and iconv with translit

    Stefan Schmiedl, Mar 3, 2007, in forum: Ruby
    Replies:
    2
    Views:
    202
    Stefan Schmiedl
    Mar 3, 2007
  5. Krzysztof Cierpisz

    iconv "\n" (Iconv::InvalidCharacter)

    Krzysztof Cierpisz, Sep 8, 2009, in forum: Ruby
    Replies:
    0
    Views:
    194
    Krzysztof Cierpisz
    Sep 8, 2009
Loading...

Share This Page