Does the mysql query field contain Chinese characters

use 

SELECT column FROM table WHERE length(column)!=char_length(column)

When the character set is UTF8:

  • Use length: The length of a Chinese character is 3
  • Use char_length: the length of a Chinese character is 1

So when there are no Chinese characters, using length and char_length have the same result.

When there are Chinese characters, it is better to use char_length to get the character length more accurately.

test

Guess you like

Origin blog.csdn.net/sumengnan/article/details/113107727