Manual, or with Automatic with PerlIO layers MySQL::dbd > v 4 --------------- ---------------- --------- --------- ---------- ¦ UTF-8 ¦ ---decode_utf8()->> ¦ Perl ¦ ---encode_utf8()->> ¦ UTF-8 ¦ ¦ Console ¦ <<-encode_utf8()--- ¦ strings ¦ <<-decode_utf8()--- ¦ MySQL DB ¦ --------- --------- ---------- #### CREATE TABLE test_db.test ( string VARCHAR(50) ) CHARACTER SET utf8; #### use Encode qw( decode_utf8 ); my $string = <>; my $utf8_string = decode_utf8($string); #### use Encode qw( decode ); my $iso_8859_string = <>; my $utf8_string = decode('ISO-8859-1',$iso_8859_string); #### use utf8; # Tells Perl that the script itself is written in UTF-8 my $utf8_string = "UTF-8 string with special chars: ñ æ ô"; #### use DBI(); my $dbh = DBI->connect ('dbi:mysql:test_db', $username, $password, {mysql_enable_utf8 => 1} ); #### $dbh->do('INSERT INTO test_db.test VALUES(?)', $utf8_string); $dbh->do('SELECT string FROM test_db.test LIMIT 1'); my $new_string = $dbh->fetchrow_arrayref->[0]; #### use Encode qw( encode_utf8 ); print Encode::encode_utf8($new_string); OR # Add an auto-encoding layer binmode (STDIN,':utf8'); print $new_string; #### use Encode qw( encode ); print Encode::encode('ISO-8859-1', $new_string);