Still, many computers still operate in locale with a traditional (limited) character encoding. Some programs, like mailers and web browsers, must be able to convert between a given text encoding and the user's encoding. Other programs internally store strings in Unicode, to facilitate internal processing, and need to convert between internal string representation (Unicode) and external string representation (a traditional encoding) when they are doing I/O. GNU libiconv is a conversion library for both kinds of applications.
iconv()
implementation, for use on systems which
don't have one, or whose implementation cannot convert from/to Unicode.
It provides support for the encodings:
uint16_t
or uint32_t
(with machine dependent endianness and alignment)--enable-extra-encodings
, it also provides
support for a few extra encodings:
It has also some limited support for transliteration, i.e. when a character cannot be represented in the target character set, it can be approximated through one or several similarly looking characters. Transliteration is activated when "//TRANSLIT" is appended to the target encoding name.
libiconv is for you if your application needs to support multiple character encodings, but that support lacks from your system.
$ ./configure --prefix=/usr/local $ make $ make install
After installing GNU libiconv for the first time, it is recommended to recompile and reinstall GNU gettext, so that it can take advantage of libiconv.
On systems other than GNU/Linux, the iconv program will be internationalized only if GNU gettext has been built and installed before GNU libiconv. This means that the first time GNU libiconv is installed, we have a circular dependency between the GNU libiconv and GNU gettext packages, which can be resolved by building and installing either
This library can be built and installed in two variants:
libiconv.so
and a header file <iconv.h>
. (Both are installed
through "make install".)
To use it, simply #include <iconv.h>
and use the functions.
To use it in an autoconfiguring package:
m4/iconv.m4
to your aclocal.m4
file.m4/iconv.m4
to your m4 macro repository.@LIBICONV@
(or, if using libtool for
the link, @LTLIBICONV@
). If you use automake, the right place for
these additions are the *_LDADD variables.iconv.m4
is also part of the GNU gettext package, which
installs it in /usr/local/share/aclocal/iconv.m4
.
libiconv_plug.so
. This library can be used with
LD_PRELOAD, to override the iconv* functions present in the C library.
$ export LD_PRELOAD=/usr/local/lib/libiconv_plug.so
$ export _RLD_LIST=/usr/local/lib/libiconv_plug.so:DEFAULT
/pub/gnu/libiconv/
on your favorite
GNU mirror. For other ways to
obtain libiconv, please read
How to get GNU Software.
The latest release is http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz
iconv
programPlease send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.
Please send comments on these web pages to webmasters@www.gnu.org, send other questions to gnu@gnu.org.
Copyright (C) 1998, 2006 Free Software Foundation, Inc., 51 Franklin St., 5th Floor, Boston, MA 02110, USA
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
Last updated: $Date: 2006/09/11 15:04:18 $ $Author: johnsu01 $