SrtParser\srtFile::cp1252_to_utf8 PHP Метод

cp1252_to_utf8() публичный статический Метод

Converts Windows-1252 (CP-1252) to UTF-8
public static cp1252_to_utf8 ( string $text )
$text string The string to be converted
    public static function cp1252_to_utf8($text)
    {
        $buffer = $text;
        $cp1252 = array(128 => "€", 130 => "‚", 131 => "ƒ", 132 => "„", 133 => "…", 134 => "†", 135 => "‡", 136 => "ˆ", 137 => "‰", 138 => "Š", 139 => "‹", 140 => "Œ", 142 => "Ž", 145 => "‘", 146 => "’", 147 => "“", 148 => "”", 149 => "•", 150 => "–", 151 => "—", 152 => "˜", 153 => "™", 154 => "š", 155 => "›", 156 => "œ", 158 => "ž", 159 => "Ÿ");
        $buffer_encoded = utf8_encode($buffer);
        foreach ($cp1252 as $ord => $encoded) {
            $buffer_encoded = str_replace(utf8_encode(chr($ord)), $encoded, $buffer_encoded);
        }
        return $buffer_encoded;
    }