diff --git a/src/sammo/JosaUtil.php b/src/sammo/JosaUtil.php index 2046bd46..c0b2cfa9 100644 --- a/src/sammo/JosaUtil.php +++ b/src/sammo/JosaUtil.php @@ -517,15 +517,12 @@ class JosaUtil{ return true; } - public static function check(string $text, string $type=''){ + public static function check(string $text, string $type){ JosaUtil::init(); $htarget = preg_replace(JosaUtil::REG_INVALID_CHAR_W_HANJA, ' ', $text); $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){ return false; } @@ -543,9 +540,14 @@ class JosaUtil{ if(\key_exists($hcode, \sammo\JosaUtil::$jongsungHanja)){ 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 = $code[count($code)-1]; $code = StringUtil::uniord($code);