homepage Welcome to WebmasterWorld Guest from
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

 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 =











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

 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


 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.


 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