note 73402 added to function.quoted-printable-decode

From: Date: Wed, 21 Feb 2007 19:09:07 +0000
Subject: note 73402 added to function.quoted-printable-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-123676@lists.php.net to get a copy of this message
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 //L: note $encoding that is uppercase //L: also your PHP installation must have ctype_alpha, otherwise write it yourself function quoted_printable_encode($string, $encoding='UTF-8') { // use this function with headers, not with the email body as it misses word wrapping $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; } } //L: so spam agents won't mark your email with QP_EXCESS if (!$enc) return $string; return '=?'.$encoding.'?q?'.$result.'?='; } I hope it helps ;) ?> ---- Server IP: 213.92.11.19 Probable Submitter: 151.44.87.253 ---- Manual Page -- http://www.php.net/manual/en/function.quoted-printable-decode.php Edit -- https://master.php.net/note/edit/73402 Del: integrated -- https://master.php.net/note/delete/73402/integrated Del: useless -- https://master.php.net/note/delete/73402/useless Del: bad code -- https://master.php.net/note/delete/73402/bad+code Del: spam -- https://master.php.net/note/delete/73402/spam Del: non-english -- https://master.php.net/note/delete/73402/non-english Del: in docs -- https://master.php.net/note/delete/73402/in+docs Del: other reasons-- https://master.php.net/note/delete/73402 Reject -- https://master.php.net/note/reject/73402 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123676) next »