Skip to content

Instantly share code, notes, and snippets.

@phene
Created June 28, 2011 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phene/1051889 to your computer and use it in GitHub Desktop.
Save phene/1051889 to your computer and use it in GitHub Desktop.
sed -e 's/CHARSET=latin1/CHARSET=utf8/g' dbdump.sql > dbdump.utf8.sql
@bradland
Copy link

bradland commented Jan 5, 2012

Found your post about UTF-8 and Rails useful, but I had a couple of notes on this snippet.

  1. This won't run in a console because it contains smart quotes. Try this instead:
sed -e 's/CHARSET=latin1/CHARSET=utf8/g' dbdump.sql
  1. This command will output to your console, but won't actually change the file. Sed is a stream editor, which means it works with streams: text in/text out. You have to tell it where to send the output. I'd recommend:
sed -e 's/CHARSET=latin1/CHARSET=utf8/g' dbdump.sql > dbdump-utf8.sql

You'll need to adjust the other steps in your tutorial to accommodate the updated file name though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment