{% else-1 %}

                        
<?php

function win2utf($str)
{
static $table = array(
"\xA8" => "\xD0\x81",
"\xB8" => "\xD1\x91",
"\xA1" => "\xD0\x8E",
"\xA2" => "\xD1\x9E",
"\xAA" => "\xD0\x84",
"\xAF" => "\xD0\x87",
"\xB2" => "\xD0\x86",
"\xB3" => "\xD1\x96",
"\xBA" => "\xD1\x94",
"\xBF" => "\xD1\x97",
"\x8C" => "\xD3\x90",
"\x8D" => "\xD3\x96",
"\x8E" => "\xD2\xAA",
"\x8F" => "\xD3\xB2",
"\x9C" => "\xD3\x91",
"\x9D" => "\xD3\x97",
"\x9E" => "\xD2\xAB",
"\x9F" => "\xD3\xB3",
);
return preg_replace('#[\x80-\xFF]#se',
' "$0" >= "\xF0" ? "\xD1".chr(ord("$0")-0x70) :
("$0" >= "\xC0" ? "\xD0".chr(ord("$0")-0x30) :
(isset($table["$0"]) ? $table["$0"] : "")
)',
$str
);
}

//пример
echo win2utf('тест в windows-1251');
?>
0 51 0
0

Нет фото
Xrom * 0.37
• 3 май 2013, 08:54


Зачем так извращаться?
iconv(\"windows-1251\", \"utf-8\", \"my super text\"*;