note 50926 deleted from function.recode-string by nlopess
| From: | nlopess@php.net | Date: | Mon, 14 Mar 2005 15:18:42 +0000 |
| Subject: | note 50926 deleted from function.recode-string by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86411@lists.php.net to get a copy of this message | ||
Note Submitter:
----
add a note User Contributed Notes
recode_string
jazfresh at spam-javelin.hotmail.com
27-Oct-2003 01:55
I came across a bug (and workaround) when using recode_string. When converting from utf-8 to
iso-2022-jp, it would always return an empty string (although it would work fine for conversions
from html to utf8). Converting with recode on the command line worked fine, which was odd. I noticed
that if I specified "-v" on the command line, recode stated that it was using libiconv to
do the conversion.
Using "iconv" instead of recode got the right results.
i.e.
Works:
$str = recode_string("html..utf-8", "日本語"); //
Unicode for "Japanese"
Doesn't work:
$str = recode_string("utf-8..iso-2022-jp", $mystring);
Works:
$str = iconv("utf-8", "iso-2022-jp", $mystring);
Don't ask me why. Hope this saves someone some frustrating hours debugging.
kumar at chicagomodular dot com
29-Sep-2002 09:54
GNU recode reference manual:
http://www.delorie.com/gnu/docs/recode/recode_toc.html
gleis at netz-profis dot de
17-Aug-2001 05:48
Just 'man recode' for further details.