I a newbie in Perl, working on a legacy application. I am missing some special characters like ä,å,ö in my database. previously, Mysql database was in latin1 collation, now changed to UTF-8 default. When I look in database values, these characters are not changed (still getting some other characters for å,ö,ä). I looked into perl code, I found this encoding and charset seems it is not working. any help is appreciated. thanks.
use Encode qw/is_utf8 decode/;
my($q) = CGI->new();
$q->charset('utf-8');
$q->header(-charset => 'utf-8', -expires => '-1d')
connection to database
my($dbh) = DBI->connect($config{'dbDriver'},$config{'dbUser'},$config{'dbPass'}) or die "Kunde inte ansluta till $config{'dataSource'}: " . $DBI::errstr;
$dbh->{'mysql_enable_utf8'} = 1;
$dbh->do('SET NAMES utf8');
Try using
SET NAMES 'UTF-8';on connect to the database.