As soletan at toxa dot de reported, that function is very bad and does not provide valid enquoted printable strings. While using it I saw spam agents marking the emails as QP_EXCESS and sometimes the email client did not recognize the header at all; I really lost time :(. This is the new version (we use it in the Drake CMS core) that works seamlessly:
<?php
function quoted_printable_encode($string, $encoding='UTF-8') {
$len = strlen($string);
$result = '';
$enc = false;
for($i=0;$i<$len;++$i) {
$c = $string[$i];
if (ctype_alpha($c))
$result.=$c;
else if ($c==' ') {
$result.='_';
$enc = true;
} else {
$result.=sprintf("=%02X", ord($c));
$enc = true;
}
}
if (!$enc) return $string;
return '=?'.$encoding.'?q?'.$result.'?=';
}
I hope it helps ;)
?>