PHP Classes

Special characters ?

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  Special characters ?  >  (Un) Subscribe thread alerts  
Subject:Special characters ?
Summary:Special characters breaking the subject ?
Messages:6
Author:Namida
Date:2008-02-25 21:43:36
Update:2008-12-28 20:55:16
 

  1. Special characters ?   Reply   Report abuse  
Picture of Namida Namida - 2008-02-25 21:43:36
Hello there and thanks for this top notch class ;)

One issue though, I tryed the typical "RE: mail subject" and it seems like the ":" symbol actually breaks the class.

After that I get "=?ISO-8859-1?q?RE=3A_mail_subject?=" when I parse the data...

Any suggestions ?

Thanks in advance ;)

PS: this might be related to encoding and such, so I ask since I really don't know much about that and/or conversion functions/methods

PS2: this actually looks like encoding related, not only because of the nature of the bug but also because of that "ISO-8859-1" that I believe is the encoding charset for LATAM

  2. Re: Special characters ?   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-02-26 22:44:45 - In reply to message 1 from Namida
That is q-encoding. It is necessary when the header values have 8 bit characters or other characters that may be interpreted as syntax errors depending on the type of header, like for instance headers with e-mail addresses.

In the case of the Subject header, q-encoding is not really necessary, although it really does not hurt.

Coincidentally I was just studing changes that I can make to the class to use only q-encoding for e-mail address headers without breaking backwards compatibility.

Probably I will release a new version of the class this week with those changes.

  3. Re: Special characters ?   Reply   Report abuse  
Picture of Namida Namida - 2008-03-20 13:24:32 - In reply to message 2 from Manuel Lemos
Thanks for your answer ;)

(and sorry for taking so long to submit mine, I was abroad...)

Thanks for your efforts, I'll download the latest version now and let you know if anything comes up.

Thanks again ;)

  4. Re: Special characters ?   Reply   Report abuse  
Picture of Kronik Kronik - 2008-12-15 10:24:47 - In reply to message 3 from Namida
Hi Manuel.
Did you fixed this problem yet?

I try to decode mail header:
Subject: Re: [#56619] speed test =?UTF-8?Q?=28Tur=C3=A8ik=29?=

The class should return text with some CE characters, but returns actual subject line.


<?php
require_once("mime_class.php");
$mime=new mime_parser_class;
$mime->mbox = 0;
$mime->decode_bodies = 0;
$mime->ignore_syntax_errors = 1;
$parameters=array(
'Data'=>'
*** mail source***
',

'SkipBody'=>1,
);

if(!$mime->Decode($parameters, $decoded))
echo 'MIME message decoding error: '.$mime->error.' at position '.$mime->error_position."\n";
else
{
// show mail subject
echo $decoded[0][Headers]["subject:"];

}
?>

Does your class actaly decode subject encodings or I'm doing something wrong here?

  5. Re: Special characters ?   Reply   Report abuse  
Picture of Kronik Kronik - 2008-12-28 19:53:48 - In reply to message 4 from Kronik
Nevermind. I used
php.net/manual/en/function.iconv-mi ... and it's working fine.

  6. Re: Special characters ?   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-12-28 20:55:16 - In reply to message 4 from Kronik
The class returns all headers that may need decoding in the DecodedHeaders entry of the decoded array returned by the Decode function.