Php judges Chinese and English characters. Encoding table double byte character encoding range 1.gbk( gb2312gb18030) x00-xffgbk double byte encoding range x20-x7fasciixa1-xff Chinese gb2312x80-xff Chinese gbk2.utf-8 (unicode) u4e00-u9fa5 encoding table
Double byte character encoding range
1. gbk (gb2312/gb18030)
X00-xff gbk dubyte encoding range
X20-x7f (ascii)
Xa1-xff Chinese gb2312
X80-xff Chinese gbk
2. UTF-8 (unicode)
U4e00-u9fa5)
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 the case of gb2312
If (preg_match ("/^ [x7f-xff] + $/", $ str) {// Compatible with gb2312, UTF-8
Echo "correct input ";
} Else {
Echo "incorrect input ";
}
?>
There are actually a lot of knowledge about Chinese judgment problems. The underlying internal encoding involves UTF-8, gbk, and gb13800. I have studied how to differentiate what a character is. There are too many associated details.
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...