As this article says, there is no quoted_printable_encode
function() in PHP: http:/
/www.zend.com/manual/filters.convert.php
However there is a stream filter for quoted printable
encoding. Here's an example function that produces output
suitable for email and doesn't explicitly use external files
(though it might do for strings over 2Mb due to the nature
of the temp stream type):
<?php
function quoted_printable_encode($string) {
$fp = fopen('php://temp/', 'r+');
$params = array('line-length' => 70,
'line-break-chars' => "rn");
stream_filter_append($fp,
'convert.quoted-printable-encode', STREAM_FILTER_READ,
$params);
fputs($fp, $string);
rewind($fp);
return stream_get_contents($fp);
}
echo quoted_printable_encode(str_repeat("hello there
", 50)." a=1rn")."n";
?>
The filter needs to be restricted to STREAM_FILTER_READ
because by default it will get filtered both going into and
out of the stream, and will thus get encoded twice.
It should be much faster than using a PHP implementation of
the same thing, though note that this will only work in PHP
5.1+.
----
Server IP: 85.116.0.130
Probable Submitter: 87.74.30.27
----
Manual Page -- http://ww
w.php.net/manual/en/ref.stream.php
Edit -- https://master
.php.net/note/edit/70826
Del: integrated -- h
ttps://master.php.net/note/delete/70826/integrated
Del: useless -- http
s://master.php.net/note/delete/70826/useless
Del: bad code -- htt
ps://master.php.net/note/delete/70826/bad+code
Del: spam -- https:/
/master.php.net/note/delete/70826/spam
Del: non-english --
https://master.php.net/note/delete/70826/non-english
Del: in docs -- http
s://master.php.net/note/delete/70826/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/70826
Reject -- https://mast
er.php.net/note/reject/70826
Search -- https://
master.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|