Вход Регистрация
* russalp

Перевод из WIN в UTF8

  1. <?php
  2. //------------------ Функция
  3. перекодировки из WIN в
  4. UTF --------------------//
  5. function win_to_utf($str) {
  6. ('mb_convert_encoding'))
  7. ($str, 'utf-8',
  8. 'windows-1251');
  9. if (function_exists('iconv'))
  10. return iconv('windows-1251',
  11. 'utf-8', $str);
  12. $win1251utf8 = array(
  13. "xC0"=>"А","xC1"=>"Б","xC2"=>"В","xC3"=>"Г","xC4"=>"Д","xC5"=>"Е","xA8"=>"Ё","xC6"=>"Ж","xC7"=>"З","xC8"=>"И","xC9"=>"Й","xCA"=>"К","xCB"=>"Л","xCC"=>"М",
  14. "xCD"=>"Н","xCE"=>"О","xCF"=>"П","xD0"=>"Р","xD1"=>"С","xD2"=>"Т","xD3"=>"У","xD4"=>"Ф","xD5"=>"Х","xD6"=>"Ц","xD7"=>"Ч","xD8"=>"Ш","xD9"=>"Щ","xDA"=>"Ъ",
  15. "xDB"=>"Ы","xDC"=>"Ь","xDD"=>"Э","xDE"=>"Ю","xDF"=>"Я","xE0"=>"а","xE1"=>"б","xE2"=>"в","xE3"=>"г","xE4"=>"д","xE5"=>"е","xB8"=>"ё","xE6"=>"ж","xE7"=>"з",
  16. "xE8"=>"и","xE9"=>"й","xEA"=>"к","xEB"=>"л","xEC"=>"м","xED"=>"н","xEE"=>"о","xEF"=>"п","xF0"=>"р","xF1"=>"с","xF2"=>"т","xF3"=>"у","xF4"=>"ф","xF5"=>"х",
  17. "xF6"=>"ц","xF7"=>"ч","xF8"=>"ш","xF9"=>"щ","xFA"=>"ъ","xFB"=>"ы","xFC"=>"ь","xFD"=>"э","xFE"=>"ю","xFF"=>"я");
  18. return strtr($str,
  19. $win1251utf8);
  20. }
  21. ?>
» Описание: Перевод из WIN в UTF8
» Время добавления: 29 Окт 2014 в 20:53
» Посмотров: 1276
» textarea
» Рейтинг: [+0 | -0]
Комментарии [0]
Онлайн: 3
Реклама