note 97983 added to function.iconv-mime-encode

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.