Exemple #1
0
 /**
  * Convert full-width Japanese Roman characters to ASCII roman characters.
  * 
  * This helps the user not having to shift out of the Japanese input mode to write ascii stuff.
  * 
  * Note: not thoroughly tested beyond the digits (0-9)
  * 
  * @param  string  Utf8 string
  * 
  * @return string  Utf8 string
  */
 static function normalizeFullWidthRomanCharacters($u8s)
 {
     $aUCS = utf8::toUnicode($u8s);
     for ($i = 0; $i < count($aUCS); $i++) {
         if ($aUCS[$i] >= 0xff10 && $aUCS[$i] <= 0xff5a) {
             $aUCS[$i] = $aUCS[$i] - 0xff00 + 32;
         }
     }
     return utf8::fromUnicode($aUCS);
 }
Exemple #2
0
 public static function toCodePoint($kanji)
 {
     $ucsa = utf8::toUnicode($kanji);
     return $ucsa[0];
 }