iconv supports too few encoding
Posted
by
schemacs
on Super User
See other posts from Super User
or by schemacs
Published on 2014-06-05T02:16:15Z
Indexed on
2014/06/05
3:29 UTC
Read the original article
Hit count: 471
iconv -l
outputs too few encodings on CentOS 6.5:
$ iconv -l 10646-1:1993, 10646-1:1993/UCS4, ANSI_X3.4-1968, ANSI_X3.4-1986, ANSI_X3.4, ASCII, CP367, CSASCII, CSUCS4, IBM367, ISO-10646, ISO-10646/UCS2, ISO-10646/UCS4, ISO-10646/UTF-8, ISO-10646/UTF8, ISO-IR-6, ISO-IR-193, ISO646-US, ISO_646.IRV:1991, OSF00010020, OSF00010100, OSF00010101, OSF00010102, OSF00010104, OSF00010105, OSF00010106, OSF05010001, UCS-2, UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UCS2, UCS4, UNICODEBIG, UNICODELITTLE, US-ASCII, US, UTF-8, UTF8, WCHAR_T
But on my Ubuntu the list seems much longer, here is different:
CentOS6.5:
$ php -a
php > echo iconv('utf8', 'gbk', 'abc');
PHP Notice: iconv(): Wrong charset, conversion from `utf8' to `gbk' is not allowed in php shell code on line 1
php > quit
$ php -i|grep iconv
iconv
iconv support => enabled
iconv implementation => glibc
iconv library version => 2.12
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1
Ubuntu 14.04:
$ php -a Interactive mode enabled
php > echo iconv('utf8', 'gbk', "abc\n");
abc
php > quit
$ php -i|grep iconv
iconv
iconv support => enabled
iconv implementation => glibc
iconv library version => 2.19
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1
But I don't want to recompile glibc(this will be huge mount of work), any idea on how to ad new encoding support?
© Super User or respective owner