You are looking for information on the topic “Using like with mariadb and chinese characters”. boviptaynguyen.com will gather information to answer your questions in this article. Please read this article to the end to find the information you want to see. You can also check out some other related articles here: 226 new posts updated mariadb password charset, mariadb collation, mariadb show character set, mariadb character_set_system, wrong database collation character_set_database is utf8mb4 but it needs to be utf8.
View information about the Using like with mariadb and chinese characters
Information about this question
- Question: Using like with mariadb and chinese characters
- Time: Updated 20 days ago
- Modified: Asked 73 minute ago
- View: 7057
Using like with mariadb and chinese characters
To use the LIKE
operator with Chinese characters in MariaDB, you need to make sure that you are using a character set and collation that supports Chinese characters.
First, you should set the character set of your database to a Chinese character set. For example, you can use utf8mb4
which supports the full Unicode character set:
sqlALTER DATABASE your_database_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Next, when creating your table, you should specify the same character set and collation:
sqlCREATE TABLE your_table_name ( id INT PRIMARY KEY, name VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci );
Finally, when using the LIKE
operator to search for Chinese characters, you need to use the COLLATE
keyword to specify the collation to use for the search. For example, to search for names that contain the character “中”:
sqlSELECT * FROM your_table_name WHERE name LIKE '%中%' COLLATE utf8mb4_unicode_ci;
This query will return all rows where the name
column contains the character “中”, regardless of whether it is in simplified or traditional Chinese, or whether it is in upper or lower case.
Watch videos related to “Using like with mariadb and chinese characters”
How Many Chinese Characters Do I Need To Learn? – Learn Chinese Characters with Yoyo Chinese
How to insert Chinese characters in mysql?
To insert Chinese characters in MySQL, you can follow these steps:
- Set the character set of the MySQL connection to UTF-8. You can do this by executing the following query after connecting to the MySQL database:
sqlSET NAMES 'utf8mb4';
- Create a table with a column of data type VARCHAR or TEXT.
For example:
sqlCREATE TABLE example_table ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(50) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
- When inserting data into the table, make sure to use the correct character set encoding for the Chinese characters. For example, if you are inserting data through an SQL query, you can use the following format:
sqlINSERT INTO example_table (name) VALUES ('中文');
In this example, the Chinese characters ‘中文’ are enclosed in single quotes, and the SQL query uses the same character set encoding as the MySQL connection (UTF-8 in this case).
- If you encounter any issues with character encoding or collation, you can also try setting the collation explicitly when creating the table or column. For example, you could use:
sqlCREATE TABLE example_table ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(50) NOT NULL COLLATE utf8mb4_unicode_ci, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
The ‘utf8mb4_unicode_ci’ collation is commonly used for Chinese characters and supports sorting and comparison of strings based on the Unicode standard.
What encoding to use for Chinese characters?
There are several encodings that can be used for Chinese characters, each with its own advantages and disadvantages. Here are some of the most common ones:
-
Unicode: Unicode is a universal character encoding standard that supports almost all writing systems, including Chinese. It provides a unique code point for each character, making it an ideal choice for multilingual applications.
-
GB2312: GB2312 is a Chinese character encoding standard that covers most Simplified Chinese characters. It is widely used in mainland China.
-
Big5: Big5 is a Chinese character encoding standard that covers most Traditional Chinese characters. It is widely used in Taiwan and Hong Kong.
-
GBK: GBK is an extension of GB2312 that includes additional Chinese characters. It is widely used in mainland China.
-
UTF-8: UTF-8 is a variable-length character encoding standard that can represent any Unicode character. It is widely used in web applications and is the recommended encoding for HTML pages.
In general, Unicode is the most widely used and recommended encoding for Chinese characters, as it provides the most comprehensive coverage and is compatible with most software and platforms. However, the choice of encoding will depend on the specific requirements of your application and the region in which it will be used.
Which encoding scheme is for Chinese and Japanese characters?
Chinese and Japanese characters can be encoded using several different encoding schemes, but the most common ones are:
-
Unicode: This is a universal character encoding standard that supports characters from multiple writing systems, including Chinese and Japanese. Unicode assigns a unique code point to each character, allowing it to be represented and processed consistently across different platforms and applications.
-
GB18030: This is a Chinese government standard that extends the widely used GB2312 character set to include a much larger range of Chinese characters. GB18030 is backward compatible with GB2312 and also supports Unicode characters.
-
Shift JIS: This is a character encoding scheme used for Japanese text. It is a variable-length encoding that uses one byte for ASCII characters and two bytes for non-ASCII characters, including Japanese hiragana, katakana, and kanji.
-
EUC-JP: This is another character encoding scheme used for Japanese text. It is also a variable-length encoding that uses one byte for ASCII characters and two bytes for non-ASCII characters, but it has a slightly different structure from Shift JIS.
Overall, Unicode is the most widely used encoding scheme for Chinese and Japanese characters, as it provides a standardized and consistent way to represent text across different platforms and applications.
Images related to Using like with mariadb and chinese characters
Found 17 Using like with mariadb and chinese characters related images.

![Mdev-13543] Mariadb Command Client Don'T Support Non Acsii Character - Jira](https://jira.mariadb.org/secure/attachment/43991/43991_create+none+ascii+name+database.png)

You can see some more information related to Using like with mariadb and chinese characters here
- HOW TO MADE MARIADB CAN STORE THE CHINESE …
- False duplicate with mariadb and chinese characters
- MySQL Chinese, Japanese, and Korean Character Sets
- Can’t insert Chinese character into MySQL – Stack Overflow
- Traditional Chinese / simplified Chinese character translator – Google
- Japanese and traditional-Chinese extended UNIX code (EUC … – IBM
- One language, two writing systems: Traditional and Simplified Chinese
- DB Writer for Chinese Characters into MariaDB – KNIME Forum
- Chinese Characters cannot be dispalyed in data grid after …
- Form select statement or search query with Chinese characters
- Selecting Rows With Chinese Characters in MySQL
- 1187469 – Can’t input non-ASCII UTF-8 characters in mysql …
- [sqllab] query table with wildcard like ‘%中文%’ with Chinese …
- “value too long for type character varying” Is … – 华为云
Comments
There are a total of 445 comments on this question.
- 1011 comments are great
- 206 great comments
- 178 normal comments
- 87 bad comments
- 33 very bad comments
So you have finished reading the article on the topic Using like with mariadb and chinese characters. If you found this article useful, please share it with others. Thank you very much.