use Encode 'from_to'; use utf8; ... my $sth = $dbh_r->prepare("set CHARACTER SET cp1251_koi8;"); $sth->execute(); $sth = $dbh_r->prepare( "SELECT * FROM test_table_org;"); $sth->execute(); ... while (my $row = $sth -> fetchrow_arrayref){      ...      Encode::from_to($row->[1], "cp1251", "utf-8");      ... }