In particular, computers with the Windows operating system 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:
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.soand 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.m4to 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.m4is also part of the GNU gettext package, which installs it in
preloadable_libiconv.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/preloadable_libiconv.so
$ export _RLD_LIST=/usr/local/lib/preloadable_libiconv.so:DEFAULT
libcharsetlibraries and their header files are under LGPL.
iconv program is under GPL.
The latest development sources can be obtained through the savannah project.
Please send general FSF & GNU inquiries to
There are also other ways to contact the FSF.
Please send broken links and other corrections or suggestions to
Copyright (C) 1998, 2019 Free Software Foundation, Inc.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
Last updated: $Date: 2019/05/09 00:50:43 $ $Author: haible $