한자 케이스 우회

This commit is contained in:
2018-06-01 03:01:06 +09:00
parent 663c24b31f
commit 275d9b1c25
+7 -5
View File
@@ -517,15 +517,12 @@ class JosaUtil{
return true; return true;
} }
public static function check(string $text, string $type=''){ public static function check(string $text, string $type){
JosaUtil::init(); JosaUtil::init();
$htarget = preg_replace(JosaUtil::REG_INVALID_CHAR_W_HANJA, ' ', $text); $htarget = preg_replace(JosaUtil::REG_INVALID_CHAR_W_HANJA, ' ', $text);
$htarget = preg_replace(JosaUtil::REG_TARGET_CHAR, '$1', $htarget); $htarget = preg_replace(JosaUtil::REG_TARGET_CHAR, '$1', $htarget);
$target = preg_replace(JosaUtil::REG_INVALID_CHAR, ' ', $text);
$target = preg_replace(JosaUtil::REG_TARGET_CHAR, '$1', $target);
if(!$htarget){ if(!$htarget){
return false; return false;
} }
@@ -543,9 +540,14 @@ class JosaUtil{
if(\key_exists($hcode, \sammo\JosaUtil::$jongsungHanja)){ if(\key_exists($hcode, \sammo\JosaUtil::$jongsungHanja)){
return true; return true;
} }
return false; if($hcode < JosaUtil::KO_START_CODE || JosaUtil::KO_FINISH_CODE < $hcode){
return false;
}
} }
$target = preg_replace(JosaUtil::REG_INVALID_CHAR, ' ', $text);
$target = preg_replace(JosaUtil::REG_TARGET_CHAR, '$1', $target);
$code = StringUtil::splitString($target); $code = StringUtil::splitString($target);
$code = $code[count($code)-1]; $code = $code[count($code)-1];
$code = StringUtil::uniord($code); $code = StringUtil::uniord($code);