I created a dump of a table from one database and tried to insert data from this file into a table with a similar structure. The data was inserted, but I received a warning:

Warning Code: 1366 Incorrect string value: '\ xC7 \ xE4 \ xE0 \ xED \ xE8 \ xE5 ...' for column 'placement' at row 1

And in the field of placement instead of the text in Russian, the type of coarseness was inserted:

"??? 05/03 ?????"

In the old database this field was defined as:

 `placement` blob 

and in the new how:

 `placement` varchar(255) DEFAULT NULL 

In the schemas of both DBs, both old and new, the default encoding is cp1251 :

 ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=cp1251 

At the same time, when I open the dump file as a test file, the text of this field is displayed in normal form. What is the problem and how to fix it?

UPD The problem seems to be how to read the SQLyog dump file , because after opening the file in the SQLyog window , I see the following:

enter image description here

    1 answer 1

    The BLOB field is not encoded and stores the data as is.

    You need to answer two questions:

    1. In what encoding did you have the data in the blob?
    2. What encoding do you use to import to the database?

    For your situation, these two encodings must match.

    I suspect that the data in your blob was in cp1251, and your connection encoding is utf-8. Then just import the problem table with two commands.

     SET NAMES cp1251; INSERT INTO .... SET NAMES utf8; 

    But this will all work if there are no other text fields in the table.