<?
$ru = array("Ё","ё","©","®","™","€",
"А","Б","В","Г","Д","Е","Ж","З","И","Й","К","Л","М","Н","О","П",
"Р","С","Т","У","Ф","Х","Ц","Ч","Ш","Щ","Ъ","Ы","Ь","Э","Ю","Я",
"а","б","в","г","д","е","ж","з","и","й","к","л","м","н","о","п",
"р","с","т","у","ф","х","ц","ч","ш","щ","ъ","ы","ь","э","ю","я");
$ru_tr= array('Ё', 'ё', 'Ж', 'ж', 'Ч', 'ч', 'Щ', 'щ', 'Ю', 'ю', 'Я', 'я',
'А', 'а', 'Б', 'б', 'В', 'в', 'Г', 'г', 'Д', 'д', 'Е', 'е',
'З', 'з', 'И', 'и', 'Й', 'й', 'К', 'к', 'Л', 'л', 'М', 'м',
'Н', 'н', 'О', 'о', 'П', 'п', 'Р', 'р', 'С', 'с', 'Т', 'т',
'У', 'у', 'Ф', 'ф', 'Х', 'х', 'Ц', 'ц', 'Ш', 'ш', 'ъ', 'Ы', 'ы', 'ь', 'Э', 'э');
$en_tr= array('Jo', 'jo', 'Zh', 'zh', 'Ch', 'ch', 'Sh', 'sh', 'Ju', 'ju', 'Ja', 'ja',
'A', 'a', 'B', 'b', 'V', 'v', 'G', 'g', 'D', 'd', 'E', 'e',
'Z', 'z', 'I', 'i', 'J', 'j', 'K', 'k', 'L', 'l', 'M', 'm',
'N', 'n', 'O', 'o', 'P', 'p', 'R', 'r', 'S', 's', 'T', 't',
'U', 'u', 'F', 'f', 'H', 'h', 'C', 'c', 'W', 'w', Chr(34), 'Y', 'y', Chr(39), 'X', 'x');
// UTF-8 Win-1251
function utf8_to_win($str) {
global $ru;
$ru_utf8= array("Ё","ё","©","®","™","€",
"A","Р‘","B","Р“","Р”","E","Р–","3","Р?","Р™","K","Р›","M","H","O","Рџ",
"P","C","T","РЈ","Р¤","X","Р¦","Р§","РЁ","Р©","РЄ","Р«","b","Р","Р®","РЇ",
"a","Р±","РІ","Рі","Рґ","e","Р¶","Р·","u","Р№","k","Р»","Рј","РЅ","o","Рї",
"p","c","С‚","y","С„","x","С†","С‡","С€","С‰","СЉ","С‹","СЊ","СЌ","СЋ","СЏ");
return str_replace($ru_utf8, $ru, $str);
}
// Win-1251 UTF-8
function win_to_utf8($str) {
global $ru;
$ru_utf8= array("Ё"=>"РЃ","ё"=>"С‘","©"=>"В©","®"=>"В®","™"=>"в„ў","€"=>"€",
"А"=>"A","Б"=>"Р‘","В"=>"B","Г"=>"Р“","Д"=>"Р”","Е"=>"E","Ж"=>"Р–","З"=>"3","И"=>"Р?","Й"=>"Р™","К"=>"K","Л"=>"Р›","М"=>"M","Н"=>"H","О"=>"O","П"=>"Рџ",
"Р"=>"P","С"=>"C","Т"=>"T","У"=>"РЈ","Ф"=>"Р¤","Х"=>"X","Ц"=>"Р¦","Ч"=>"Р§","Ш"=>"РЁ","Щ"=>"Р©","Ъ"=>"РЄ","Ы"=>"Р«","Ь"=>"b","Э"=>"Р","Ю"=>"Р®","Я"=>"РЇ",
"а"=>"a","б"=>"Р±","в"=>"РІ","г"=>"Рі","д"=>"Рґ","е"=>"e","ж"=>"Р¶","з"=>"Р·","и"=>"u","й"=>"Р№","к"=>"k","л"=>"Р»","м"=>"Рј","н"=>"РЅ","о"=>"o","п"=>"Рї",
"р"=>"p","с"=>"c","т"=>"С‚","у"=>"y","ф"=>"С„","х"=>"x","ц"=>"С†","ч"=>"С‡","ш"=>"С€","щ"=>"С‰","ъ"=>"СЉ","ы"=>"С‹","ь"=>"СЊ","э"=>"СЌ","ю"=>"СЋ","я"=>"СЏ");
return strtr($str, $ru_utf8);
}
/**/
// Win-1251 ST
function win_to_st($str) {
global $ru;
$ru_st= array("Ё","ё", "©","®","™","€",
"A","Б","B","Г","Д","E","Ж","3","И","Й","K","Л","M","H","O","П",
"P","C","T","У","Ф","X","Ц","Ч","Ш","Щ","Ъ","Ы","Ь","Э","Ю","Я",
"a","б","в","г","д","e","ж","з","и","й","k","л","м","н","o","п",
"p","c","т","y","ф","x","ц","ч","ш","щ","ъ","ы","ь","э","ю","я");
return str_replace($ru, $ru_st, $str);
}
function del_symb($str) {
return preg_replace("/[^\\xA\\x20-\\x7FА-я\\xA9\\xAE\\x99\\x88\\x93\\x94\\x96]/", "", $str);
}
function trans ($str) {
global $ru_tr, $en_tr;
return str_replace($en_tr, $ru_tr, $str);
}
function ru_to_trans ($str) {
global $ru_tr, $en_tr;
return str_replace($ru_tr, $en_tr, $cyrstr);
}
function changes32 ($str)
{//10
$m1= array(chr(0), chr(1), chr(2), chr(3), chr(4), chr(5), chr(6), chr(7), chr(8), chr(9),
chr(11), chr(12), chr(13),
chr(14), chr(15), chr(16), chr(17), chr(18), chr(19),
chr(20), chr(21), chr(22), chr(23), chr(24), chr(25), chr(26), chr(27), chr(28), chr(29),
chr(30), chr(31));
$m2= array("", "", "", "", "", "", "", "", "", " ",
"", "", "",
"", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "");
return str_replace($m1, $m2, $str);
}
function ChangeSt ($str){
$m1= array(chr(34), "$", "&", chr(39), "<", ">", chr(147), chr(148), chr(150));
$m2= array("\"", "$$", "&", "'", "<", ">", "\"", "\"", "-");
return str_replace($m1, $m2, $str);
}
?>