MySQL incorrectly stores foreign characters

Using SQLite, this works great. However, when I switch to MySQL, instead クインI get ???. TEXT column or sometimes VARCHAR (255) (I consider it VARCHAR (255) in this case).

How do I get MySQL to store these characters correctly?

+3
source share
2 answers

Table and column set characters must be installed in a version that supports multi-byte characters, such as UTF8.

You can specify the current character set of the table by doing

mysql> SHOW CREATE TABLE tbl_Name;

It may not show you anything, in which case it uses the default value my.cnf

To change the character set in a table:

mysql> ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

, . .

, , . http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html

, UTF-8, CHARACTER SET utf8 COLLATE utf8_general_ci CREATE TABLE

+6

, "charset = utf8" .

connectionString="Server=myServerHost;charset=UTF8;Database=myDatabase;Uid=root;Pwd=password;"

MySQL :

  • ,
+2

Source: https://habr.com/ru/post/1746721/


All Articles