[OpenIndiana-discuss] php iconv //TRANSLIT error

Albert Lee trisk at opensolaris.org
Wed May 4 15:48:20 UTC 2011


On Wed, May 4, 2011 at 10:41 AM, Gordon Ross <gordon.w.ross at gmail.com> wrote:
> On Wed, May 4, 2011 at 9:27 AM, gerard henry <solarg87 at gmail.com> wrote:
>> do you think that it is the same problem described here:
>> http://woss.name/2008/10/16/edge-rails-pre-22-iconv-transliteration-and-solaris/
>
> Yes.  Any code expecting to call iconv_open(3C) with a code set name
> containing "//translit" and/or "//ignore" is depending non-standard features
> of GNU iconv.  The iconv(3C) function provides ways for the caller to do
> equivalent things (see the iconv error returns).  The calling code would be
> more portable if modified to do its own handling of characters that can not
> be converted (at least when linked with something other than GNU iconv).
>

Gordon is absolutely right. The PHP iconv functions unfortunately do
not report the iconv() return value directly but you *can* make them
generate an exception on conversion failure.

I fixed this problem in the Roundcube webmail system and you can see
the discussion here:
http://trac.roundcube.net/ticket/1486375

You can use the final implementation in the commit at the end of the
ticket as a "good" [1] example for how to use iconv in PHP...

[1] PHP sucks.

-Albert



More information about the OpenIndiana-discuss mailing list