简体   繁体   中英

Insert UTF-8 txt file into MySql results in ErrorCode 1366

I am trying to insert a delimited txt file into MySQL but it seems there is something wrong with the encoding. I get Error coe 1366:Incorrect string value in in MYSQL when I try and insert. When I open the txt file it looks like this on the line that caused the error.

在此处输入图片说明

Any idea how can I insert this data?

You need to escape special characters. Something like \\' for quote and so on

Somehow hex 9C got into the file. In latin1, that is œ .

Plan A:

Edit the file to remove it. The text around there is all in uppercase English, so I suspect it was not supposed to be œ .

Plan B:

Use the charset option to set the incoming stream to latin1 . Then deal with œ later (or not).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM