Samuel Sjöberg's weblog

Skip to navigation

mysqldump, utf-8 and OS X

I had serious trouble with dumping utf-8 encoded data into a utf-8 encoded file that could be imported into mysql again. The problem was that the file was encoded into Wester ISO-1 no matter what encoding I used when I dumped the data.

I think I have found the source of the problem: The default encoding of files in the OS X terminal. My solution to this was to pipe the data into bbEdit (which supports encoding as a start-up parameter) and save the file manually.

This is the command I used:

mysqldump --default-character-set=utf8 --host=host 
   --user=username --password=password --quote-names 
   --complete-insert --extended-insert --quick 
   --compact --lock-tables=false --skip-add-locks 
   --add-drop-table --databases databaseName
| bbEdit -e utf-8

I would really like a solution that not requires any user interaction if that is possible on OS X (I believe it should be).

Reader comments

  1. Did you get any solution? I'm stuck exactly in the same place :-(

    27th June 2008, 03:43 CET. 

Pages linking to this entry

Pingback is enabled on all archived entries. Read more about pingback in the Pingback 1.0 Specification.

About this post

Created 20th February 2006 22:36 CET. Filed under Mac OS X.

1 Comment
0 Pingbacks