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: Sun, 06 Jul 2014 21:46:17 +0200 Lines: 51 Message-ID: <53B9A789.4050403@arnowelzel.de> References: <53B7520B.8080506@arnowelzel.de> <53b754c5$0$6705$9b4e6d93@newsspool2.arcor-online.net> <53B88BF4.4070600@arnowelzel.de> <53b94f86$0$6713$9b4e6d93@newsspool2.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net 6Q9muWYqIyThOgwwV+p9Hw7VMXm6XoXJotYtovhxDIwvvKftqs Cancel-Lock: sha1:W9P167yMHYcapNjY/b75mnWqCEI= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <53b94f86$0$6713$9b4e6d93@newsspool2.arcor-online.net> X-Enigmail-Version: 1.6 Xref: csiph.com comp.lang.php:14073 Christoph Michael Becker, 2014-07-06 15:30: > Arno Welzel wrote: > >> Christoph Michael Becker, 2014-07-05 03:28: >> >>> 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); >>>> break; >>>> } >>>> >>>> $body = renderPlainText($body); >>>> } >>> >>> What about a default clause, at least triggering a notice/warning that >>> the encoding is not understood? >> >> Good Point. But which other encoding except no encoding at all, base64 >> and or quoted printable may be used? > > The PHP manual documents 6 values for the transfer encodings[1]. > Particularly 2 (BINARY) and 5 (OTHER) seem to demand some further > handling (if only to ignore the body in these cases, what might be > necessary to avoid potential vulnerabilities). > > [1] Thanks for the clarification - that's the URL I also referred to originally ;-) -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de http://fahrradzukunft.de