Skip to content

Instantly share code, notes, and snippets.

@WenLiangTseng
Created January 3, 2014 09:30
Show Gist options
  • Save WenLiangTseng/8235288 to your computer and use it in GitHub Desktop.
Save WenLiangTseng/8235288 to your computer and use it in GitHub Desktop.
Convert Chinese String to UTF8 code.
<?php
function chineseToUnicode( $str ){
$str = rawurlencode( $str );
$str = str_replace("%", "", $str);
return $str;
}
//Print result
$str = "旴";
echo chineseToUnicode( $str );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment