Guest User

http://goo.gl/FGVof6

a guest
Aug 29th, 2013
1,552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1.     //Author: [email protected]
  2.     function chineseToUnicode($str){
  3.         //split word
  4.         preg_match_all('/./u',$str,$matches);
  5.        
  6.         $c = "";
  7.         foreach($matches[0] as $m){
  8.             $c .= "&#".base_convert(bin2hex(iconv('UTF-8',"UCS-4",$m)),16,10);
  9.         }
  10.         return $c;
  11.     }
  12.     //Print result
  13.     $str = "買野 測試 Stackoverflow";
  14.     echo chineseToUnicode($str);
Add Comment
Please, Sign In to add comment