php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #35068 iconv encoding names different on AIX
Submitted: 2005-11-02 15:51 UTC Modified: 2005-11-03 11:08 UTC
From: Bjorn dot Wiberg at its dot uu dot se Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: AIX 5.2.0.0 ML6
Private report: No CVE-ID: None
 [2005-11-02 15:51 UTC] Bjorn dot Wiberg at its dot uu dot se
Description:
------------
Under IBM AIX, using the IBM-shipped version of libiconv (package bos.rte.iconv) requires one to use "ISO8859-1" instead of "ISO-8859-1" in the call to iconv() when dealing with ISO latin-1 character set conversions.

Probably one should set iconv.input_encoding, iconv.internal_encoding and iconv.output_encoding to "ISO8859-1" as well, in php.ini or the Apache server configuration (to override the default values of "ISO-8859-1").

Other similar cases seem to be present, see:
http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/genprogc/convert_prg.htm#HDRDNNRI49HOWA

This may be worth to point out in the PHP iconv documentation:
http://www.php.net/iconv

Furthermore, this may very well be the cause for the iconv tests failing under AIX.


Reproduce code:
---------------
The package origin of the libiconv.a file is given by:

$ lslpp -w /usr/lib/libiconv.a 
  File                                        Fileset               Type
  ----------------------------------------------------------------------------
  /usr/lib/libiconv.a                         bos.rte.iconv         File


Version information is given by:

$ lslpp -la | grep iconv
  bos.iconv.com              5.2.0.0  COMMITTED  Common Language to Language
  bos.iconv.ucs.com          5.2.0.0  COMMITTED  Unicode Base Converters for
  bos.rte.iconv              5.2.0.0  COMMITTED  Language Converters


Working PHP code for translating some Swedish characters in character set ISO8859-1 to UTF-8:

<?php
  if (function_exists('iconv')) {
                                $namn = iconv('ISO8859-1', 'UTF-8', "åäö");
                                echo "Result: $namn";
  }
?>

Using "ISO-8859-1" does not work!


Excerpt from 'make test':

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------

/../

iconv() test 1 [ext/iconv/tests/iconv001.phpt]
iconv_mime_encode() sanity cheeck. [ext/iconv/tests/iconv004.phpt]
iconv_mime_decode() [ext/iconv/tests/iconv_mime_decode.phpt]
iconv_mime_decode_headers() [ext/iconv/tests/iconv_mime_decode_headers.phpt]
iconv_mime_encode() [ext/iconv/tests/iconv_mime_encode.phpt]
iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
iconv_strlen() [ext/iconv/tests/iconv_strlen.phpt]
iconv_strpos() [ext/iconv/tests/iconv_strpos.phpt]
iconv_strrpos() [ext/iconv/tests/iconv_strrpos.phpt]
iconv_substr() [ext/iconv/tests/iconv_substr.phpt]

/../

Actual result:
--------------
iconv() returning FALSE when the conversion fails (due to "incorrect" encoding specified).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-02 16:03 UTC] Bjorn dot Wiberg at its dot uu dot se
Perhaps it would be possible to make sure that php.ini-dist and php.ini-recommended (and the default values in PHP, for the situation where no php.ini is found) get modified on AIX upon ./configure, testing or installation, unless GNU libiconv is found?

php -i reports the following under AIX by default (no php.ini is in place here so the local and master values are equal).

---8<---
phpinfo()
PHP Version => 5.0.5

/../

Configuration File (php.ini) Path => /apache/php/lib

/../

iconv

iconv support => enabled
iconv implementation => unknown
iconv library version => unknown

Directive => Local Value => Master Value
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
--->8---

Best regards,
Bj?rn
 [2005-11-02 17:00 UTC] sniper@php.net
It's pretty idiotic by IBM to do that. Why not tell them to fix their crap?

 [2005-11-02 18:03 UTC] Bjorn dot Wiberg at its dot uu dot se
Hello sniper!

I agree with you (and understand if you'd rather not "patch" for this), although these kind of quirks seem to appear all the time with OSes from the "big" companies... :-/

In any case, it may be worth pointing out in the documentation, at least, so that people will be aware of this difference.

Thanks in advance!

Best regards,
Bj?rn
 [2005-11-03 11:08 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

"Some systems (like IBM AIX) use "ISO8859-1" instead of "ISO-8859-1" so this value has to be used in configuration options and function parameters."
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 08 22:01:31 2025 UTC