note 89417 added to function.quoted-printable-decode
| From: | feedr at osu1 dot php dot net | Date: | Fri, 06 Mar 2009 22:39:37 +0000 |
| Subject: | note 89417 added to function.quoted-printable-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151573@lists.php.net to get a copy of this message | ||
Another (improved) version of quoted_printable_encode(). Please note the order of the array elements
in str_replace().
I've just rewritten the previous function for better readability.
<?php
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 and CRLF pairs aren't encoded though.
*/
function quoted_printable_encode($string) {
$string = str_replace(array('%20', '%0D%0A', '%'), array('
', "\r\n", '='), rawurlencode($string));
$string = preg_replace('/[^\r\n]{73}[^=\r\n]{2}/', "$0=\r\n", $string);
return $string;
}
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 217.238.27.209
----
Manual Page -- http://www.php.net/manual/en/function.quoted-printable-decode.php
Edit -- https://master.php.net/note/edit/89417
Del: integrated -- https://master.php.net/note/delete/89417/integrated
Del: useless -- https://master.php.net/note/delete/89417/useless
Del: bad code -- https://master.php.net/note/delete/89417/bad+code
Del: spam -- https://master.php.net/note/delete/89417/spam
Del: non-english -- https://master.php.net/note/delete/89417/non-english
Del: in docs -- https://master.php.net/note/delete/89417/in+docs
Del: other reasons-- https://master.php.net/note/delete/89417
Reject -- https://master.php.net/note/reject/89417
Search -- https://master.php.net/manage/user-notes.php