Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: comp.lang.php Subject: Re: Encoding Problems Date: Fri, 11 Jul 2014 18:47:55 +0200 Lines: 44 Message-ID: <53C0153B.9070807@arnowelzel.de> References: <53B7520B.8080506@arnowelzel.de> <53B7529D.9050002@arnowelzel.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net b4frkSgsSHP1NsJeHxcJnAh32kEbGUFfvnwDjgKogFVHNOye+h Cancel-Lock: sha1:064ifK3GtvgEyLotS4vH/ro6O6g= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: X-Enigmail-Version: 1.6 Xref: csiph.com comp.lang.php:14100 stef_204, 2014-07-10 15:57: > On Sat, 05 Jul 2014 03:19:25 +0200, Arno Welzel wrote: > >>> So extend that for the encoding: >>> >>> if($msgStructure->subtype=="PLAIN") >>> { >>> switch($msgStructure->encoding) >>> { >>> case 4: >>> // Body text is quoted-printable encoded $body = >>> quoted_printable_decode($body); break; >>> >>> case 3: >>> // Body text is base64 encoded $body = base64_decode($data); >> >> Ups - sorry for the c&p typo. Of course it should be: >> >> $body = base64_decode($body); >> >>> break; >>> } >>> >>> $body = renderPlainText($body); >>> } > > Arno, > > The above seems to work. Thanks. > I still get a little bit of garbled text due to charset utf-8 (I believe) > but we are now 99% better on the $body. Just keep in mind, that my example is not complete and just a suggestion how to start - there should also be a case to handle text with transfer encoding which does not need decoding at all and a default case to handle unknown encodings. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de