Encoding table
Double-byte character encoding range
1. GBK (gb2312/gb18030)
X00-xff GBK Double byte encoding range
x20-x7f ASCII
Xa1-xff Chinese gb2312
X80-xff Chinese GBK
2. Utf-8 (Unicode)
U4E00-U9FA5 (English)
x3130-x318f (Korean
XAC00-XD7A3 (Korean)
u0800-u4e00 (Japanese)
$str = "China";
Echo $str;
echo "";
if (Preg_match ("/^[". Chr (0XA1). " -". Chr (0xff)." +$/", $str)) {//can only be used in gb2312 cases
if (Preg_match ("/^[x7f-xff]+$/", $str)) {//compatible gb2312,utf-8
echo "Correct input";
} else {
echo "Error input";
}
?>
Chinese judgment problem, in fact, there are many knowledge, the underlying internal code, involving utf-8,gbk,gb13800 of various different. Have studied how to differentiate a character from what character the problem is. Too many association details.
http://www.bkjia.com/PHPjc/632325.html www.bkjia.com true http://www.bkjia.com/PHPjc/632325.html techarticle encoding table double-byte character encoding range 1. GBK (gb2312/gb18030) x00-xff GBK Double-byte encoding range x20-x7f ASCII xa1-xff Chinese gb2312 x80-xff Chinese GBK 2. Utf-8 (UNIC ODE) U4e00-u9fa5 ...