homepage Welcome to WebmasterWorld Guest from 54.166.53.169
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
quoted printable decode not working on plain/text emails
Output is blank, removing spaces helps but only a little.
JAB Creations

WebmasterWorld Senior Member jab_creations us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4591320 posted 11:42 pm on Jul 8, 2013 (gmt 0)

Here is some quote printable text from an email...

=0A=0A=A0=0AJohn=0A(800) 123-4567=0A=0A----- Forwarded Message =

=20=0ASent:=20Thursday,=20July=204,=202013=204:14=20PM=0ASubject:=20Your=20Despicab=

le=20Me=202=20iTunes=20Download=0A=20=0A=0A=0ADespicable=20Me=202=20=0A=20=20=0A=20Your=20purchase=20=

of=20tickets=20for=20Despicable=20Me=202=20has=20earned=20you=20a=20complimentary=20download=20of=20t=

he=20song=20'Just=20a=20Cloud=20Away'=20by=20Pharrell=20from=20the=20Original=20Motion=20Picture=20So=

undtrack=20on=20iTunes.=20=0AWe=20hope=20you=20enjoy=20the=20song=20and=20the=20film!=0AIf=20you=20ha=

ve=20iTunes=20installed,=20click=20here=20to=20start=20your=20complimentary=20download.=0AIF=20=

YOU=20DO=20NOT=20HAVE=20iTunes=20INSTALLED:=0A=0A1.=20Download=20iTunes=20for=20Mac=20or=20Window=

s,=20free=20of=20charge=20at=20www.iTunes.com.=20=0A2.=20Open=20iTunes=20and=20click=20iTunes=20Sto=

re.=20=0A3.=20Click=20Redeem=20under=20Quick=20Links.=20=0A4.=20Enter=20the=20code=20below.=20Your=20=

download=20will=20start=20immediately.=20Enjoy.=20=0ADownload=20Code:=20FML6H34XXTMJ=20=0AC=


Unfortunately when I use...

$b = quoted_printable_decode($b);


...the output is blank.

There were some spaces so I tried to replace them...


if (stristr($b,' ')) {$b = str_replace(' ','=20',$b);}


...and that seemed to sort of help.

I've come across a couple sites where converting this text worked, how come it's not working for me?

Here are the relevant email headers...

Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable


- John

 

JAB Creations

WebmasterWorld Senior Member jab_creations us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4591320 posted 4:10 am on Jul 9, 2013 (gmt 0)

Well I have a temporary work-around...

I looked out the source output and discovered the dreaded black diamonds with question marks in them. After comparing the before and after I found the culprit to be "=A0" (without quotes).

I am using this temporarily until I can discover how to deal with this unknown entity...

if (stristr($b,'=A0')) {$c = str_replace('=A0','',$b);}


Can anyone please post a link to a page with a table containing the character codes using in quoted printable? Either I'm not referencing the terminology right for the past three days or my understanding of it needs a little added accuracy.

- John

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4591320 posted 5:41 am on Jul 9, 2013 (gmt 0)

the =XX strings look like ascii character codes in hexadecimal, so =20 is a blank space character and =0A is a new line character.
it also looks like there's an extraneous "=" at the end of each line.

swa66

WebmasterWorld Senior Member swa66 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4591320 posted 7:16 am on Jul 9, 2013 (gmt 0)

with hexdec() [php.net...] and chr() [php.net...] , you should be able to replace them all back to what they were before the encoding, but take great care what you do next with that data. It can contain *anything* evil.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved