|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-01-14 09:24 UTC] werner at aloah-from-hell dot de
Description:
------------
Hi everybody,
we've discovered, that the PHP funktion iconv() does not work with the
PHP-CLI in PHP 5.2.12. PHP is configured with the following Options:
./configure --enable-magic-quotes --enable-libxml --enable-session --
with-pcre-regex --with-pear --enable-xml --enable-simplexml --enable-
static --enable-safe-mode --enable-sigchild --disable-debug --disable-
rpath --enable-cli --enable-bcmath --enable-exif --enable-gd-native-
ttf --enable-gd-jis-conv --enable-mbstring --enable-mbreg
ex --enable-posix --enable-sockets --with-curl --with-gd=/usr/local --
with-ttf --with-png-dir=/usr --with-jpeg-dir --with-t1lib --with-zlib
--with-iconv --with-imap=/usr/lib64 --with-imap-ssl --with-mysql --
with-openssl --with-kerberos --with-xpm-dir --with-freetype-dir=/usr -
-with-apxs2=/usr/local/apache2/bin/apxs --disable-cgi --dis
able-ipv6 --disable-pdo --without-sqlite --disable-spl --with-
mcrypt=/usr --enable-soap
ICONV-Support ist active:
server:# php -r 'phpinfo();'|grep -i iconv
...
iconv
iconv support => enabled
iconv implementation => glibc
iconv library version => 2.3.6
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
Kind regards,
Werner
Reproduce code:
---------------
<?php
$text = "abcde";
echo iconv('UTF-8', 'ISO-8859-1', $text), PHP_EOL;
?>
Expected result:
----------------
With PHP 5.2.11:
server:# /usr/local/bin/php /tmp/test.php
abcde
server:#
Actual result:
--------------
With PHP 5.2.12:
server:# /usr/local/bin/php /tmp/test.php
server:#
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 08:00:02 2025 UTC |
Hi, thanks for the quick response. I did some more testing ... and it seems like the problem is not related to PHP. On one machine with PHP 5.2.12 installed: server1:# php -n -d error_reporting=E_ALL -r 'echo iconv("utf-8", "iso-8859-1","abcde"), PHP_EOL;' abcde server1:# server2:# php -n -d error_reporting=E_ALL -r 'echo iconv("utf-8", "iso-8859-1","abcde"), PHP_EOL;' Notice: iconv(): Unknown error (29) in Command line code on line 1 server2:# The configure-Options for PHP are the same on both machines. Any Ideas? regards, WernerHi again, I've switched back to PHP 5.2.11 on server2 (on which the iconv-call did not work with PHP-CLI 5.2.12) and it's working: server2:# php -n -d error_reporting=E_ALL -r 'echo iconv("utf-8", "iso-8859-1","abcde"), PHP_EOL;' abcde server2:# Compared to PHP-CLI 5.2.12: server2:# php -n -d error_reporting=E_ALL -r 'echo iconv("utf-8", "iso-8859-1","abcde"), PHP_EOL;' Notice: iconv(): Unknown error (29) in Command line code on line 1 server2:# So maybe this could be a PHP issue ? Thanks, Werner strace php -n -d error_reporting=E_ALL -r 'echo iconv("utf-8", "iso- 8859-1","abcde"), PHP_EOL;'