Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Author: [email protected]
- function chineseToUnicode($str){
- //split word
- preg_match_all('/./u',$str,$matches);
- $c = "";
- foreach($matches[0] as $m){
- $c .= "&#".base_convert(bin2hex(iconv('UTF-8',"UCS-4",$m)),16,10);
- }
- return $c;
- }
- //Print result
- $str = "買野 測試 Stackoverflow";
- echo chineseToUnicode($str);
Add Comment
Please, Sign In to add comment