talideon.com

Everyone’s alive! Everyone survived!

May 26, 2008 at 6:22PM Converting a quoted-printable string to plaintext

This was sitting around doing nothing, and I thought it was worth posting up.

function from_quoted_printable($s) {
    $result = preg_replace("/=\n/m", '', $s);
    $result = preg_replace('/=([0-9A-F]{2})/e', "pack('H2', '\\1')", $result);
    return $result;
}
Technorati Search Technorati Search Irish Bloggers

Comments

No comments.

Post a comment

All form information is optional, but it’s a good idea to fill in your name and email address if you want me to take your comment seriously.

Spammers, don’t bother posting crap down here. The site is set up so that legitimate search engines (Google, for instance) won’t index pages with comments on them. Posting crud here only means you’re wasting my time and patience. Shoo!

Real names, please. Please include!
Won’t be displayed. Please include!
Displayed, if present.