/** * Validate and normalize a UTF string to NFKD * * @param string &$str Unchecked UTF string * @return string The string, validated and in normal form */ function nfkd(&$str) { $pos = strspn($str, UTF8_ASCII_RANGE); $len = strlen($str); if ($pos == $len) { // ASCII strings return immediately return; } if (!isset($GLOBALS['utf_compatibility_decomp'])) { include(IP_ROOT_PATH . 'includes/utf/data/utf_compatibility_decomp.' . PHP_EXT); } $str = utf_normalizer::decompose($str, $pos, $len, $GLOBALS['utf_compatibility_decomp']); }
/** * Validate and normalize a UTF string to NFKD * * @param string &$str Unchecked UTF string * @return string The string, validated and in normal form */ static function nfkd(&$str) { $pos = strspn($str, UTF8_ASCII_RANGE); $len = strlen($str); if ($pos == $len) { // ASCII strings return immediately return; } if (!isset($GLOBALS['utf_compatibility_decomp'])) { global $mangareader_root_path; include($mangareader_root_path . 'includes/utf/data/utf_compatibility_decomp.php'); } $str = utf_normalizer::decompose($str, $pos, $len, $GLOBALS['utf_compatibility_decomp']); }