note 31815 added to function.utf8-decode

From: Date: Mon, 05 May 2003 06:25:46 +0000
Subject: note 31815 added to function.utf8-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-47526@lists.php.net to get a copy of this message
A simple way to convert utf-8 encoded strings... (PHP 4 >= 4.3.0) <?php $newstring = html_entity_decode(htmlentities($utf8_string, ENT_COMPAT, 'UTF-8')); ?> (For 4.1.0 >= PHP < 4.3.0 use this function instead of html_entity_decode) <?php function unhtmlentities ($string) { $trans_tbl = get_html_translation_table (HTML_ENTITIES); $trans_tbl = array_flip ($trans_tbl); return strtr ($string, $trans_tbl); } $newstring = unhtmlentities(htmlentities($utf8_string, ENT_COMPAT, 'UTF-8')); ?> //Johan -- http://www.php.net/manual/en/function.utf8-decode.php http://master.php.net/manage/user-notes.php?action=edit+31815 http://master.php.net/manage/user-notes.php?action=delete+31815 http://master.php.net/manage/user-notes.php?action=reject+31815

« previous php.notes (#47526) next »