Bug #12980 output of mysqldump not reversible
Submitted: 5 Sep 2005 4:48 Modified: 5 Sep 2005 14:34
Reporter: Matthew Wilson Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S2 (Serious)
Version:4.1.15 OS:Windows (windows)
Assigned to: CPU Architecture:Any

[5 Sep 2005 4:48] Matthew Wilson
Description:
when using mysqldump to output to a text file, windows encodes the resulting file as ascii and not utf8.  This causes database backups, when re-imported, to have incorrect characters in utf8 "text" fields.  The workaround I use is to open the .sql file in Ultraedit, and convert it from ascii to utf8 encoding.  Then it imports back into mysql correctly.  Extremely annoying.

How to repeat:
where anyDatabase is a database with some utf8 text fields, and where some of those utf8 text fields have nonascii characters.

c:\>mysqldump anyDatabase >myDatabaseBackup.sql
c:\>mysql
mysql>use anyDatabase;
mysql>\. myDatabaseBackup.sql

Suggested fix:
add a command line parameter to mysqldump whereby the script/batch file writer can specify a path and/or file to output to.  Encode the output file in UTF8 by default, but perhaps allow the user to specify.
[5 Sep 2005 4:58] Matthew Wilson
should be classified under command-line clients.