Code:
function rus_to_lat($text) {
$gost = array(
"Ä"=>"EH","Æ"=>"I","і"=>"i","№"=>"#","є"=>"eh",
"ÃÂ"=>"A","Ñ"=>"B","ÃÂ’"=>"V","Ó"=>"G","Ô"=>"D",
"Õ"=>"E","ÃÂ"=>"JO","Ö"=>"ZH",
"×"=>"Z","Ø"=>"I","Ù"=>"JJ","Ú"=>"K","Û"=>"L",
"ÃÂœ"=>"M","ÃÂ"=>"N","Þ"=>"O","ß"=>"P","à"=>"R",
"á"=>"S","â"=>"T","ã"=>"U","ä"=>"F","ÃÂ¥"=>"KH",
"æ"=>"C","ç"=>"CH","è"=>"SH","é"=>"SHH","ê"=>"'",
"ë"=>"Y","ì"=>"","ÃÂ"=>"EH","î"=>"YU","ï"=>"YA",
"ð"=>"a","ñ"=>"b","ò"=>"v","ó"=>"g","ô"=>"d",
"õ"=>"e","ё"=>"jo","ö"=>"zh",
"÷"=>"z","ø"=>"i","ù"=>"jj","ú"=>"k","û"=>"l",
"ü"=>"m","ý"=>"n","þ"=>"o","ÿ"=>"p","р"=>"r",
"ÑÂ"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"kh",
"ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"shh","ъ"=>"",
"ы"=>"y","ь"=>"","ÑÂ"=>"eh","ю"=>"yu","ÑÂ"=>"ya","«"=>"","»"=>"","—"=>"-"
);
$iso = array(
"Ä"=>"YE","Æ"=>"I","Ã"=>"G","і"=>"i","№"=>"#","є"=>"ye","ѓ"=>"g",
"ÃÂ"=>"A","Ñ"=>"B","ÃÂ’"=>"V","Ó"=>"G","Ô"=>"D",
"Õ"=>"E","ÃÂ"=>"YO","Ö"=>"ZH",
"×"=>"Z","Ø"=>"I","Ù"=>"J","Ú"=>"K","Û"=>"L",
"ÃÂœ"=>"M","ÃÂ"=>"N","Þ"=>"O","ß"=>"P","à"=>"R",
"á"=>"S","â"=>"T","ã"=>"U","ä"=>"F","ÃÂ¥"=>"X",
"æ"=>"C","ç"=>"CH","è"=>"SH","é"=>"SHH","ê"=>"'",
"ë"=>"Y","ì"=>"","ÃÂ"=>"E","î"=>"YU","ï"=>"YA",
"ð"=>"a","ñ"=>"b","ò"=>"v","ó"=>"g","ô"=>"d",
"õ"=>"e","ё"=>"yo","ö"=>"zh",
"÷"=>"z","ø"=>"i","ù"=>"j","ú"=>"k","û"=>"l",
"ü"=>"m","ý"=>"n","þ"=>"o","ÿ"=>"p","р"=>"r",
"ÑÂ"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"x",
"ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"shh","ъ"=>"",
"ы"=>"y","ь"=>"","ÑÂ"=>"e","ю"=>"yu","ÑÂ"=>"ya","«"=>"","»"=>"","—"=>"-"
);
$rtl_standard = 1; // 1 = gost; 2 = iso
if ($rtl_standard = 1) {
return strtr($text, $gost);
} else if ($rtl_standard = 2) {
return strtr($text, $iso);
}
}
P.S. This idea from plugin rus-to-lat for Wordpress.