HTML entities转会UTF-8
2013-02-28If you need something that converts &#[0-9]+ entities to UTF-8, this is simple and works:
1 2 3 4 5 6 7 8 9 |
<?php /* Entity crap. */ $input = "Fovi&#269;"; $output = preg_replace_callback("/(&#[0-9]+;)/", function($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, $input); /* Plain UTF-8. */ echo $output; ?> |