| 448 |
$newvalue=headerDecode($newvalue); // maybe there are more encoded |
$newvalue=headerDecode($newvalue); // maybe there are more encoded |
| 449 |
return(mb_convert_encoding($newvalue, "EUC-JP", "auto")); // parts |
return(mb_convert_encoding($newvalue, "EUC-JP", "auto")); // parts |
| 450 |
} else { |
} else { |
| 451 |
if (eregi('".*"',$value)) { // quoted-pair |
return(mb_convert_encoding(decode_structured_body($value), "EUC-JP", "auto")); |
|
ereg('([^"]*)"(([^"]+|\\\\.)*)"(.*)',$value,$vals); |
|
|
$newvalue = $vals[1].decode_quoted_pair($vals[2]).$vals[4]; |
|
|
return(mb_convert_encoding($newvalue, "EUC-JP", "auto")); |
|
|
} else { // there wasn't anything encoded, return the original string |
|
|
return(mb_convert_encoding($value, "EUC-JP", "auto")); |
|
|
} |
|
| 452 |
} |
} |
| 453 |
} |
} |
| 454 |
|
|
| 566 |
} |
} |
| 567 |
|
|
| 568 |
function decode_structured_body ($body) { |
function decode_structured_body ($body) { |
| 569 |
$patterns = array ("/\"((?:[^\"\\\\]+|\\\\.)*)\"/e"); |
$patterns = array ( |
| 570 |
$replace = array ("mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto')"); |
"/\"((?:[^\"\\\\]+|\\\\.)*)\"/e", |
| 571 |
|
"/\(((?:[^)\\\\]+|\\\\.)*)\)/e", |
| 572 |
|
); |
| 573 |
|
$replace = array ( |
| 574 |
|
"mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto')", |
| 575 |
|
"'('.mb_convert_encoding(decode_quoted_pair('\\1'), 'EUC-JP', 'auto').')'", |
| 576 |
|
); |
| 577 |
return preg_replace ($patterns, $replace, $body); |
return preg_replace ($patterns, $replace, $body); |
| 578 |
} |
} |
| 579 |
|
|
| 699 |
// if ($body=="") $body=" "; |
// if ($body=="") $body=" "; |
| 700 |
// } |
// } |
| 701 |
$body=decode_body($body,$message->header->content_transfer_encoding); |
$body=decode_body($body,$message->header->content_transfer_encoding); |
| 702 |
$message->body[0]=$body; |
$message->body[0] = mb_convert_encoding($body, "EUC-JP", "auto"); |
| 703 |
} |
} |
| 704 |
if (!isset($message->header->content_type_charset)) |
if (!isset($message->header->content_type_charset)) |
| 705 |
$message->header->content_type_charset=array("ISO-8859-1"); |
$message->header->content_type_charset=array("ISO-8859-1"); |