note 49816 added to function.quoted-printable-decode
| From: | drm at melp dot nl | Date: | Wed, 09 Feb 2005 11:32:35 +0000 |
| Subject: | note 49816 added to function.quoted-printable-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84712@lists.php.net to get a copy of this message | ||
A easier, improved way of encoding for quoted-printable transfer:
------
function quoted_printable_encode_character ( $matches ) {
$character = end ( $matches );
return sprintf ( '=%02x', ord ( $character ) );
}
// based on http://www.freesoft.org/CIE/RFC/1521/6.htm
function quoted_printable_encode ( $string ) {
// rule #2, #3 (leaves space and tab characters in tact)
$string = preg_replace_callback (
'/[^\x21-\x3C\x3E-\x7E\x09\x20]/',
'quoted_printable_encode_character',
$string
);
$newline = "=\r\n"; // '=' + CRLF (rule #4)
// make sure the splitting of lines does not interfere with escaped characters
// (chunk_split fails here)
preg_match_all ( '/.{73}([^=]{0,3})/', $string, $match ); // Rule #1
return implode ( $newline, $match[0] );
}
-----
----
Manual Page -- http://www.php.net/manual/en/function.quoted-printable-decode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49816
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49816&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49816&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49816&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49816&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49816&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49816&report=yes
Search -- http://master.php.net/manage/user-notes.php