Zend_Mail (encoding) problem?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Zend_Mail (encoding) problem?

Marian Meres-2
Hello Everybody,

I have run into two strange problems using Zend_Mail (UTF-8) over SMTP
transport. Both look like obvious bugs which seems quite unlikely...

---> First one:

$mail = new Zend_Mail('UTF-8');
$mail->setBodyText("Příliš žluťoučký kůň úpěl ďábelské ódy");

The above email is received like this:

   Content-Type: text/plain; charset=UTF-8
   Content-Transfer-Encoding: quoted-printable
   Content-Disposition: inline
   MIME-Version: 1.0

   P=3DC5=3D99=3DC3=3DADli=3DC5=3DA1 =3DC5=3DBElu=3DC5=3DA5ou=3DC4=3D8Dk=3D=
   C3=3DBD k=3DC5=3DAF=3DC5=3D88 =3DC3=3DBA=3D=0Ap=3DC4=3D9Bl =3DC4=3D8F=3D=
   C3=3DA1belsk=3DC3=3DA9 =3DC3=3DB3dy

Where the header is defined correctly (utf-8, quoted printable), but the
body don't seem to be. First, it's slightly different as with using php
native 'quoted_printable_encode', which I would not consider as a problem by
itself (different line width/eol settings possibly?), but also gmail thinks
it's not ok, as I can't read it in gmail...

Is this a Zend_Mime::encodeQuotedPrintable bug?

---> Second one (explicitly define body as base64):

$mail = new Zend_Mail('UTF-8');
$mail->setBodyText("Příliš žluťoučký kůň úpěl ďábelské ódy", null,
Zend_Mime::ENCODING_BASE64);

This one is received like this:

   Content-Type: text/plain; charset=UTF-8
   Content-Transfer-Encoding: quoted-printable
   Content-Disposition: inline
   MIME-Version: 1.0

   UMWZw61sacWhIMW+bHXFpW91xI1rw70ga8WvxYggw7pwxJtsIMSPw6FiZWxza8OpIMOzZHk=
   =3D

Where the header is wrong (defined as "quoted-printable" instead of expected
"base64"). The content seems to be encoded ok, but as it is defined as
quoted-printable I can't read it again.

Any light in the dark would be highly appreciated, thanks in advance!

M.
Reply | Threaded
Open this post in threaded view
|

Re: Zend_Mail (encoding) problem?

Marian Meres-2
Quick update: surprisingly, I found a bug on my end.

For anyone interested: I was getting and manipulating body text (via
$mail->getBodyText(true)) which I didn't realized was already encoded. So it
ended up being encoded twice.

Cheers,
m.

On Thu, Oct 14, 2010 at 5:12 PM, Marian Meres <[hidden email]>wrote:

> Hello Everybody,
>
> I have run into two strange problems using Zend_Mail (UTF-8) over SMTP
> transport. Both look like obvious bugs which seems quite unlikely...
>
> ---> First one:
>
> $mail = new Zend_Mail('UTF-8');
> $mail->setBodyText("Příliš žluťoučký kůň úpěl ďábelské ódy");
>
> The above email is received like this:
>
>    Content-Type: text/plain; charset=UTF-8
>    Content-Transfer-Encoding: quoted-printable
>    Content-Disposition: inline
>    MIME-Version: 1.0
>
>    P=3DC5=3D99=3DC3=3DADli=3DC5=3DA1
> =3DC5=3DBElu=3DC5=3DA5ou=3DC4=3D8Dk=3D=
>    C3=3DBD k=3DC5=3DAF=3DC5=3D88 =3DC3=3DBA=3D=0Ap=3DC4=3D9Bl
> =3DC4=3D8F=3D=
>    C3=3DA1belsk=3DC3=3DA9 =3DC3=3DB3dy
>
> Where the header is defined correctly (utf-8, quoted printable), but the
> body don't seem to be. First, it's slightly different as with using php
> native 'quoted_printable_encode', which I would not consider as a problem by
> itself (different line width/eol settings possibly?), but also gmail thinks
> it's not ok, as I can't read it in gmail...
>
> Is this a Zend_Mime::encodeQuotedPrintable bug?
>
> ---> Second one (explicitly define body as base64):
>
> $mail = new Zend_Mail('UTF-8');
> $mail->setBodyText("Příliš žluťoučký kůň úpěl ďábelské ódy", null,
> Zend_Mime::ENCODING_BASE64);
>
> This one is received like this:
>
>    Content-Type: text/plain; charset=UTF-8
>     Content-Transfer-Encoding: quoted-printable
>    Content-Disposition: inline
>     MIME-Version: 1.0
>
>    UMWZw61sacWhIMW+bHXFpW91xI1rw70ga8WvxYggw7pwxJtsIMSPw6FiZWxza8OpIMOzZHk=
>     =3D
>
> Where the header is wrong (defined as "quoted-printable" instead of
> expected "base64"). The content seems to be encoded ok, but as it is defined
> as quoted-printable I can't read it again.
>
> Any light in the dark would be highly appreciated, thanks in advance!
>
> M.
>
>