talideon.com

Blackout Ireland

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;
}