unicode转码中文

<?php
echo
mb_convert_encoding('&#5730;&#65B9;&#6492;&#6CD5', 'UTF-8', 'HTML-ENTITIES');

?>
  1. function unescape($str){
  2. $str = rawurldecode($str);
  3. preg_match_all("/&#(d+);/U",$str,$r);
  4. $arr = $r[1];
  5. $cstr = array();
  6. foreach($arr as $number){
  7. $cstr[] = iconv("UCS-2","GBK",pack("n",$number));
  8. }
  9. return join("",$cstr);
  10. }
  11. unescape(’&#37257;&#29233;’);
posted @ 2014-04-04 17:23  wint  Views(119)  Comments(0)    收藏  举报