Re: Encode e-mail text in UTF-8

From: Date: Wed, 21 Nov 2012 10:30:11 +0000
Subject: Re: Encode e-mail text in UTF-8
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-319750@lists.php.net to get a copy of this message
what is the recommended way to encode e-mail text in UTF-8? When the site were running in a single byte code page like iso-8859-2 I were happy with the imap_8bit function and quoted-printable encoding of e-mails. However, the function does not seem to work correctly for multi-byte code pages like UTF-8.
Did you use header 'Content-Type:text/html;charset=utf-8' on the email?
No, I am using text/plain content-type, more specifically: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: QUOTED-PRINTABLE The result e-mail looks like the following (I've replaced all english letters with just x): xxxxý xxxx x xříxxxx xxxxxxxxx xxxxxx xxěxx x xxxx=xxx xx xxxxxí xxxxxxxxxx xxxxxxxx x xxxxxxxxxx xxxxxxxxx x xxxxx=xxx xxxxxáxx xxxáxxx The raw encoded version of the above text is the following: xxxx=C3=BD xxxx=0A= =0A= x x=C5=99=C3=ADxxxx xxxxxxxxx xxxxxx xx=C4=9Bxx x xxxx=3Dxxx xx xxxxx=C3=AD= xxxxxxxxxx xxxxxxxx x xxxxxxxxxx xxxxxxxxx=0A= =0A= x xxxxx=3Dxxx=0A= =0A= xxxxx=C3=A1xx xxx=C3=A1xxx= The first "=" ("=3D") should be "f" and the second "a". Or you think it might be a bug in the imap_8bit or imap_mail_compose function? Parts/attachements which are rendered as BASE64 are not being malformed, just the quoted printable ones. Thanks, MC

« previous php.general (#319750) next »