Friday, 15 February 2013

php - how to transform japanese english character to normal english character? -



php - how to transform japanese english character to normal english character? -

i have japanese english language character. character not normal english language string.

characters: Game

how transform character normal english language character in php?

subtract 65248 ordinal value of each character. in other words:

$str = "Game other text ヴィックサ"; $str = preg_replace_callback( "/[\x{ff01}-\x{ff5e}]/u", function($c) { // convert utf-8 sequence ordinal value $code = ((ord($c[0][0])&0xf)<<12)|((ord($c[0][1])&0x3f)<<6)|(ord($c[0][2])&0x3f); homecoming chr($code-0xffe0); }, $str);

this replace of "fullwidth" characters normal width equivalents.

php string utf-8 character

No comments:

Post a Comment