note 86449 added to function.quoted-printable-decode
| From: | Karora at osu1 dot php dot net | Date: | Mon, 20 Oct 2008 03:27:15 +0000 |
| Subject: | note 86449 added to function.quoted-printable-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145496@lists.php.net to get a copy of this message | ||
Taking a bunch of the earlier comments together, you can synthesize a nice short and reasonably
efficient quoted_printable_encode function like this:
Note that I put this in my standard library file, so I wrap it in a !function_exists in order that
if there is a pre-existing PHP one it will just work and this will evaluate to a noop.
if ( !function_exists("quoted_printable_encode") ) {
/**
* Process a string to fit the requirements of RFC2045 section 6.7. Note that
* this works, but replaces more characters than the minimum set. For readability
* the spaces aren't encoded as =20 though.
*/
function quoted_printable_encode($string) {
return preg_replace('/[^\r\n]{73}[^=\r\n]{2}/', "$0=\r\n",
str_replace("%","=",str_replace("%20","
",rawurlencode($string))));
}
}
Regards,
Andrew McMillan.
----
Server IP: 203.89.181.186
Probable Submitter: 202.78.240.82 (proxied: 2404:130:b055:0:215:afff:fe48:6c48)
----
Manual Page -- http://www.php.net/manual/en/function.quoted-printable-decode.php
Edit -- https://master.php.net/note/edit/86449
Del: integrated -- https://master.php.net/note/delete/86449/integrated
Del: useless -- https://master.php.net/note/delete/86449/useless
Del: bad code -- https://master.php.net/note/delete/86449/bad+code
Del: spam -- https://master.php.net/note/delete/86449/spam
Del: non-english -- https://master.php.net/note/delete/86449/non-english
Del: in docs -- https://master.php.net/note/delete/86449/in+docs
Del: other reasons-- https://master.php.net/note/delete/86449
Reject -- https://master.php.net/note/reject/86449
Search -- https://master.php.net/manage/user-notes.php