I need replace email message from win1251 to koi8r encoding.
In use perl im create file cyrillic.h, here is content:

Code:
$tab{"KOI"}="\377ţ";
$tab{"WIN"}="Ũ\377";

sub convert {
	my($Src, $Dst,  $Buf) = @_;
    local $Result=$Buf;
    eval "\$Result =~ tr/$tab{$Src}/$tab{$Dst}/";
    return $Result;
}

1
Were heed im use:

$touser=convert('WIN','KOI', $touser);
$subject=convert('WIN','KOI', $subject);
$messagebody=convert('WIN','KOI', $messagebody);

How can create this with PHP

Thx