PHPMyAdmin doesn't import unicode

2019-03-04 16:02发布

问题:

When I use the import feature of PHPMyAdmin, it doesn't import non-ASCII characters such as ä, ö, ü, õ and the rest of the word after the characters.

When I open the CSV file with Notepad it displays the non-ASCII characters normally, but when I'm trying to import it - it doesn't work.

Entering those missing characters manually works and MySQL saves them just as it should. Any thoughts?

回答1:

mySQL will do this when it encounters a character that is invalid under the current character set.

You're not mentioning what tool you are using to import the data, but you should be able to specify a character set when importing. If that character set matches the database's, everything will be fine. Also, make sure the file is actually encoded in that character set.

If your import tool doesn't offer the option of selecting the character set, you could try phpMyAdmin which does.



回答2:

Make sure you know what the encoding of your CSV file is - it should be UTF-8. Then before you import, type 'use utf8', and it should work fine.