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;
}