Special characters are getting changed

sql_is_good's profile image sql_is_good posted 3 years ago in Import/Export Permalink

When I export a DB everything looks as expected. I can open up the file in a text editor and everything is as expected. When I import or open the file in HeidiSQL special characters get converted to junk. For example an mdash (—) gets converted to —. Whether I import the SQL file or run it, the special characters get ruined. I just uploaded the file to the server and used a mysql command to import the DB and everything imported just fine. No characters were changed.

The export is from a Linux server with MySQL. I am saving to a Windows machine. This happen on Version 11.3 (11.3.0.6295) and the latest version 11.3 (11.3.0.6357).

Is this a bug or is there something I should be aware of?

ansgar's profile image ansgar posted 3 years ago Permalink

SQL export files are always done in UTF-8 encoding. But for the import, it's important you select the right encoding, when you open the file:

Description

Do not select "Auto detect (may fail)" - this fails in really many cases. Select UTF-8 instead. At least if you are loading a file generated by HeidiSQL.

sql_is_good's profile image sql_is_good posted 3 years ago Permalink

Thanks for that input. I usually drag the file in to HeidiSQL. So I never saw that dialogue. Is there any way to set the default for when dragging and dropping? I looked around for that earlier today but maybe I missed it.

ansgar's profile image ansgar posted 3 years ago Permalink

When you drop files there, the default is still "Auto detect", a bad choice. I should change that to UTF8. I recommend to open files via File > Load SQL file.

Please login to leave a reply, or register at first.