Use Select...like%...% to find the MySQL text Type field of a Chinese, but found out is chaotic, found a lot of people also encounter such problems. When sorting and searching in Chinese, the result of Chinese characters is wrong.
The reason is that MySQL is not sensitive when looking for strings, character sets use ISO-8859 by default, and problems occur during the conversion process.
There are two ways to solve this:
The first method is to use the binary keyword.
The binary operator enforces the string following it as a binary string. This makes it easy to force comparisons of a column to be made in a letter-case-sensitive manner, even if the column is not defined as BINARY or BLOB.
The original SQL statement is this:
Select Id,chinese from app_name_content where Chinese like '% ze% ' limit 1;
Now the statement is:
Select Id,chinese from App_name_content where Chinese like BINARY '% ze% ' limit 1;
The second method changes the field to binary type, or it can use the like statement very well.
So you can find it exactly. MySQL, I ft!. When sorting and searching in Chinese, the result of Chinese characters is wrong.
The reason is that MySQL is not sensitive when looking for strings, character sets use ISO-8859 by default, and problems occur during the conversion process.
There are two ways to solve this:
The first method is to use the binary keyword.
The binary operator enforces the string following it as a binary string. This makes it easy to force comparisons of a column to be made in a letter-case-sensitive manner, even if the column is not defined as BINARY or BLOB.
The original SQL statement is this:
Select Id,chinese from app_name_content where Chinese like '% ze% ' limit 1;
Now the statement is:
Select Id,chinese from App_name_content where Chinese like BINARY '% ze% ' limit 1;
The second method changes the field to binary type, or it can use the like statement very well.
So you can find it exactly.
MySQL using like to find Chinese characters incorrect string value solution