2007/6/5, Bryan Alsdorf bryan mysql.com:
>
> On the bottom of view_email.php Eventum checks the
charset of the email
> and tried to display the page that way. That is where I
would start
> looking.
Hi Bryan,
I started there, as you said.
I discovered that this function is returning empty, and so,
doesn't set the
right charset.:
$charset =
Mime_Helper::getCharacterSet($email['seb_full_email']);
if (!empty($charset)) {
header("Content-Type: text/html; charset=" .
$charset);
}
The function below is the getCharacterSet called above.
In my machine, when it receives a ISO-8859-1 charset
message, it enters the
first conditional, executes the Mime_Helper::decode, and
then leave on the
second conditional, the $structure is empty.
I don't know where this $structure should be set value.
Anyone has suggestions?
/**
* Method used to get charset from raw email.
*
* access public
* param mixed $input The full body of the message
or decoded
email.
* return string charset extracted from Content-Type
header of email.
*/
function getCharacterSet($input)
{
if (!is_object($input)) {
$input = Mime_Helper::decode($input, false,
false);
} else {
$structure = $input;
}
if (empty($structure)) {
return false;
}
if ($structure->ctype_primary == 'multipart' and
$structure->ctype_secondary == 'mixed'
and count($structure->parts) >= 1 and
$structure->parts[0]->ctype_primary == 'text') {
$content_type =
$structure->parts[0]->headers['content-type'];
} else {
$content_type = $structure->headers['content-type'];
}
if
(preg_match('/charsets*=s*(["'])?([-wd]+)(1)?;?/i
',
$content_type, $matches)) {
return $matches[2];
}
return false;
}
[]s
Gutemberg Vieira
|