PHP 8.5.0 Beta 1 available for testing

Voting

: three plus five?
(Example: nine)

The Note You're Voting On

andre at luyer dot nl
16 years ago
A small update for Andrew's code below. This one leaves the original CRLF pairs intact (and allowing the preg_replace to work as intended):

<?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) {
return
preg_replace('/[^\r\n]{73}[^=\r\n]{2}/', "$0=\r\n",
str_replace("%", "=", str_replace("%0D%0A", "\r\n",
str_replace("%20"," ",rawurlencode($string)))));
}
}
?>

Regards, André

<< Back to user notes page

To Top