note 67186 added to function.mb-encode-mimeheader
| From: | chappy at citromail dot hu | Date: | Mon, 05 Jun 2006 11:33:59 +0000 |
| Subject: | note 67186 added to function.mb-encode-mimeheader | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-113236@lists.php.net to get a copy of this message | ||
I found a bad function.
<?php
function encodeHeader($input, $charset = 'ISO-8859-2')
{
preg_match_all('/(\\w*[\\x80-\\xFF]+\\w*)/', $input, $matches);
foreach ($matches[1] as $value) {
$replacement = preg_replace('/([\\x80-\\xFF])/e', '"=" .
strtoupper(dechex(ord("\\1")))', $value);
$input = str_replace($value, '=?' . $charset . '?Q?' . $replacement .
'?=', $input);
}
return $input;
}
?>
This function should be used:
<?php
function encodeHeader($input, $charset = 'ISO-8859-2')
{
$m=preg_match_all('/(\w*[\x80-\xFF]+\w*)/', $input, $matches);
if($m)$input=mb_encode_mimeheader($input,$charset, 'Q');
return $input;
}
?>
----
Server IP: 195.70.37.52
Probable Submitter: 80.85.60.132
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.mb-encode-mimeheader.php
Edit -- http://master.php.net/note/edit/67186
Del: integrated -- http://master.php.net/note/delete/67186/integrated
Del: useless -- http://master.php.net/note/delete/67186/useless
Del: bad code -- http://master.php.net/note/delete/67186/bad+code
Del: spam -- http://master.php.net/note/delete/67186/spam
Del: non-english -- http://master.php.net/note/delete/67186/non-english
Del: in docs -- http://master.php.net/note/delete/67186/in+docs
Del: other reasons-- http://master.php.net/note/delete/67186
Reject -- http://master.php.net/note/reject/67186
Search -- http://master.php.net/manage/user-notes.php