note 104617 added to function.html-entity-decode

From: Date: Sun, 26 Jun 2011 11:37:00 +0000
Subject: note 104617 added to function.html-entity-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-180959@lists.php.net to get a copy of this message
If you need something that converts &#[0-9]+ entities to UTF-8, this is simple and works: /* Entity crap. / $input = "Fovič"; $output = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $input); /* Plain UTF-8. */ echo $output; ---- Server IP: 69.147.83.197 Probable Submitter: 90.185.151.99 ---- Manual Page -- http://www.php.net/manual/en/function.html-entity-decode.php Edit -- https://master.php.net/note/edit/104617 Del: integrated -- https://master.php.net/note/delete/104617/integrated Del: useless -- https://master.php.net/note/delete/104617/useless Del: bad code -- https://master.php.net/note/delete/104617/bad+code Del: spam -- https://master.php.net/note/delete/104617/spam Del: non-english -- https://master.php.net/note/delete/104617/non-english Del: in docs -- https://master.php.net/note/delete/104617/in+docs Del: other reasons-- https://master.php.net/note/delete/104617 Reject -- https://master.php.net/note/reject/104617 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180959) next »