if ($debug_mime) $string = $charset.":".$string;
- if (ereg("iso-8859-(.*)", $charset, $res)) {
+ if (ereg("iso-8859-([[:digit:]]+)", $charset, $res)) {
if ($res[1] == "1")
return charset_decode_iso_8859_1 ($string);
else if ($res[1] == "2")
if (strpos(strtolower(trim($line)), "charset=")) {
$pos = strpos($line, "charset=") + 8;
$charset = trim($line);
- if (strpos($line, " ", $pos) > 0) {
- $charset = substr($charset, $pos, strpos($line, " ", $pos));
+ if (strpos($line, ";", $pos) > 0) {
+ $charset = substr($charset, $pos, strpos($line, ";", $pos)-$pos);
} else {
$charset = substr($charset, $pos);
}