note 50926 added to function.recode-string

From: Date: Mon, 14 Mar 2005 11:00:14 +0000
Subject: note 50926 added to function.recode-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-86392@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.recode-string.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50926 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50926&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50926&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50926&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50926&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50926&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50926&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86392) next »