bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnu-libiconv] Re: Difference between GNU libc iconv and libiconv


From: Bruno Haible
Subject: [bug-gnu-libiconv] Re: Difference between GNU libc iconv and libiconv
Date: Thu, 27 May 2010 21:17:16 +0200
User-agent: KMail/1.9.9

Hello,

Sascha Ziemann wrote:
> die iconv Program of the libiconv works different to the iconv tool
> which is part of the GNU libc. The following example shows the
> difference for the Unicode "LATIN SMALL LETTER H WITH CIRCUMFLEX"
> (U+0125; UTF-8: C4 A5):
> 
> The libiconv version:
> 
> $ ./bin/iconv --version
> iconv (GNU libiconv 1.13)
> Copyright (C) 2000-2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Written by Bruno Haible.
> $ printf '\xc4\xa5\n'|./bin/iconv -f UTF-8 -t LATIN1//TRANSLIT
> ^h
> 
> And the iconv from the libc:
> $ iconv --version
> iconv (GNU libc) 2.5
> Copyright © 2006 Free Software Foundation, Inc.
> Dies ist freie Software; in den Quellen befinden sich die Lizenzbedingungen.
> Es gibt KEINERLEI Garantie; nicht einmal für die TAUGLICHKEIT oder
> VERWENDBARKEIT FÜR EINEN ANGEGEBENEN ZWECK.
> Implementiert von Ulrich Drepper.
> $ printf '\xc4\xa5\n'|iconv -f UTF-8 -t LATIN1//TRANSLIT
> h
> 
> Is this a bug? How can i fix it? I would like to get rid of the ^ before the 
> h.

I reproduce it. But it is not a bug. The two iconv implementations have
different ways of doing transliteration to smaller character sets. In both
cases, the transliterations are defined through tables. In glibc they are
locale dependent, in libiconv they are not.

If you have your own set of transliteration tables and want to have an iconv-
like program that uses them, you can do so: Call iconv_open("LATIN1","UTF-8")
- without TRANSLIT! - and make a table lookup each time iconv() stops due
to a character that it cannot convert.

Bruno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]