unicode encoding Chinese characters

 

unicode encoding Chinese character interval  

u4E00  ----   u9FFF

 

There are also those who use u4E00 --- u9FA5, to be precise, u4E00 ---- u9FFF should be used.

u4E00 ---- u9FFF is the coding range reserved for Chinese characters.

u4E00 --- u9FA5 is the range that has been occupied by Chinese character codes until a certain point in time.

u9fa6 --- u9fff used to be an empty code and is not defined for now.

Now many codes starting with u9fa6 have been newly coded as Chinese characters, and it is no longer accurate to use u9FA5 to define Chinese characters.

 

Check whether the specified string contains Chinese characters by checking the unicode encoding:

<script>

//Check if the specified string contains Chinese characters
function checkCh(str){  	
  var myReg = new RegExp("[\\u4E00-\\u9FFF]+","g");
  return  myReg.test(str);
}
alert(checkCh('China')); //true
alert(checkCh('abc China de')); //true
alert(checkCh('abcde')); //false

</script>

 

 

 

 

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326616811&siteId=291194637