예제 #1
0
 /**
  * Validate and normalize a UTF string to NFKC
  *
  * @param	string	&$str	Unchecked UTF string
  * @return	string			The string, validated and in normal form
  */
 function nfkc(&$str)
 {
     $pos = strspn($str, UTF8_ASCII_RANGE);
     $len = strlen($str);
     if ($pos == $len) {
         // ASCII strings return immediately
         return;
     }
     if (!isset($GLOBALS['utf_nfkc_qc'])) {
         global $phpbb_root_path, $phpEx;
         include $phpbb_root_path . 'includes/utf/data/utf_nfkc_qc.' . $phpEx;
     }
     if (!isset($GLOBALS['utf_compatibility_decomp'])) {
         global $phpbb_root_path, $phpEx;
         include $phpbb_root_path . 'includes/utf/data/utf_compatibility_decomp.' . $phpEx;
     }
     $str = utf_new_normalizer::recompose($str, $pos, $len, $GLOBALS['utf_nfkc_qc'], $GLOBALS['utf_compatibility_decomp']);
 }