# Connect to the database my $dbh = DBI->connect($dsn, $user, $password, { RaiseError => 1, AutoCommit => 0, mysql_enable_utf8 => 1 }) or die "Can't connect: ", $DBI::errstr; my $sql = qq{SET NAMES 'utf8' COLLATE 'utf8_swedish_ci';}; $dbh->do($sql);