Encoding problems after export of WP database

I fought today 2 hours with this nasty little encoding bugger because one of my old blogs that I wanted to restore was stored in latin1 character set.  I tried many different export options and encoding settings but this one below does the trick. Notice that you need to define characted.set

mysqldump –opt –compress –default-character-set=latin1 -u{UserName} -p{PassWord} dbname > backup.sql

After you like to restore the database. Open the backup and find and replace all CHARSET=latin1; with CHARSET=utf8;

Then restore it. I set charsets to UTF8 on new db  just in case but I am not sure actually if it is necessary. Anyway these commands worked for me.

mysql> create database dbname;
mysql> SET NAMES utf8;
mysql> SET CHARACTER SET utf8;
mysql> use dbname;
mysql> source /pathtobackup/backup.sql