note 97983 added to function.iconv-mime-encode
| From: | markusATbirthMINUSonlineDOTde at osu1 dot php dot net | Date: | Wed, 19 May 2010 12:38:53 +0000 |
| Subject: | note 97983 added to function.iconv-mime-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169410@lists.php.net to get a copy of this message | ||
Looks like this function suffers from the same bug as mb_encode_mime() with long strings of non
us-ascii characters. The function then returns false. This applies for utf-8 to utf-8
"conversion".
<?php
$subject = 'ÐÑ Ð½Ð°Ñ
одиÑеÑÑ Ð·Ð´ÐµÑÑ:
ÐÐ»Ð°Ð²Ð½Ð°Ñ > пÑодÑкÑ';
$prefs = array(
'scheme' => 'Q',
'input-charset' => 'UTF-8',
'output-charset' => 'UTF-8',
'line-length' => 76,
'line-break-chars' => "\r\n",
);
echo 'Original: ' . $subject . PHP_EOL;
$enc = iconv_mime_encode( 'Subject', $subject, $prefs );
var_dump( $enc ); // will show bool(false)
?>
As a workaround, you could explode() the value on spaces and encode each word separately. Then
remove the "Subject: " in front of the resulting strings and join() them with "\r\n
" (don't forget the SPACE after the \n) as separator.
----
Server IP: 85.214.154.209
Probable Submitter: 87.234.222.66
----
Manual Page -- http://www.php.net/manual/en/function.iconv-mime-encode.php
Edit -- https://master.php.net/note/edit/97983
Del: integrated -- https://master.php.net/note/delete/97983/integrated
Del: useless -- https://master.php.net/note/delete/97983/useless
Del: bad code -- https://master.php.net/note/delete/97983/bad+code
Del: spam -- https://master.php.net/note/delete/97983/spam
Del: non-english -- https://master.php.net/note/delete/97983/non-english
Del: in docs -- https://master.php.net/note/delete/97983/in+docs
Del: other reasons-- https://master.php.net/note/delete/97983
Reject -- https://master.php.net/note/reject/97983
Search -- https://master.php.net/manage/user-notes.php