Carlos
11/3/2007 9:01:00 PM
[Jonathan Hudson <jh+ruby-lang@daria.co.uk>, 2007-11-03 18.45 CET]
> On Sat, 3 Nov 2007 12:06:21 -0500
> AEtzold@gmx.de wrote:
>
> > Dear Jonathan,
> >
> > > I believe that's a "feature" of ruby iconv.
> >
> > thanks for your clarifications!
> >
>
> Further, its a *feature* of iconv on **Linux**. On my FreeBSD box I
> get the expected results, both from iconv in a shell and ruby => caf'e.
>
> As, on Linux, the iconv application produces better results from ruby's
> iconv, I tend to pipe data through iconv; at least I get a semblance
> of usability that way.
It's not iconv, it's your locale data (which iconv uses). In german, "ü" is
probably transliterated to ASCII as "ue". In spanish, as "u". There isn't a
single way to do it, and they are encoded in the system locale files.
Now, why ruby's iconv gives a different result than the program iconv... I
don't know. Maybe ruby hides some LC_* environment variables from the
library (wild -and probably incorrect- guess)...
Summing up: don't use iconv to transliterate to ASCII; build your own table
instead. (It's easy: the description of all latin letters with diacritics
follow the same pattern.)
Good luck.
--