ID: 48289
Comment by: dypa at bk dot ru
Reported By: astax dot t at gmail dot com
Status: Open
Bug Type: ICONV related
Operating System: Windows
PHP Version: 5.2CVS-2009-05-15 (snap)
New Comment:
all tests give error:
Notice: iconv_mime_encode() [function.iconv-mime-encode]: Unknown error
(7) in /var/www/def.php on line 12
u...@localhost:/rss$ php -v
PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23
2009 14:35:05)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
iconv
iconv support enabled
iconv implementation glibc
iconv library version 2.9
Previous Comments:
------------------------------------------------------------------------
[2009-05-15 03:29:33] astax dot t at gmail dot com
Description:
------------
When used with "Q" scheme, iconv_mime_encode produces wrong results,
crashes of hangs. I suspect this happens with long (though not VERY
long) strings.
Lines are not correctly wrapped with "line-break-chars" parameter.
In reproduce code note missing linebreaks in encoded string and
duplicated second word in decoded string.
Reproduce code:
---------------
// Content below is in Windows-1251 charset
$str = 'Ôèëèàë "Çàïàäíî-Ñèáèðñêèé" ÎÀÎ "Ñîáèíáàíê" ðàä ïðåäñòàâèòü';
$par = array(
'scheme' => 'Q',
'input-charset' => 'CP1251',
'output-charset' => 'CP1251',
'line-length' => 74,
);
$res = iconv_mime_encode('Subject', $str, $par);
echo $res."\n";
$res = iconv_mime_decode($res, ICONV_MIME_DECODE_CONTINUE_ON_ERROR,
'CP1251');
echo $res."\n";
=================================================================
Second example:
$str = 'Òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò òåñò
òåñò òåñò òåñò';
$par = array(
'scheme' => 'Q',
'input-charset' => 'CP1251',
'output-charset' => 'CP1251',
);
$res = iconv_mime_encode('Subject', $str, $par);
echo $res."\n";
Expected result:
----------------
Subject: =?CP1251?Q?=D4=E8=EB=E8?==?CP1251?Q?=E0=EB=20?==?CP1251?Q?"?=
=?CP1251?Q?=C7=E0=EF=E0=E4=ED=EE-=D1=E8=E1=E8=F0=F1=EA=E8=E9"=20=CE=C0=CE?=
=?CP1251?Q?=20"=D1=EE=E1=E8=ED=E1=E0=ED=EA"=20=F0=E0=E4=20=EF=F0?=
=?CP1251?Q?=E5=E4=F1=F2=E0=E2=E8=F2=FC?=
Subject: Ôèëèàë "Çàïàäíî-Ñèáèðñêèé" ÎÀÎ "Ñîáèíáàíê" ðàä
ïðåäñòàâèòü
=================================================================
Second example:
expected encoded string to be displayed
Actual result:
--------------
Subject:
=?CP1251?Q?=D4=E8=EB=E8?==?CP1251?Q?=E0=EB=20?==?CP1251?Q?"=C7=E0=EF=E0=E4=ED?==?CP1251?Q?"=C7=E0=EF=E0=E4=ED=EE-=D1=E8=E1=E8=F0=F1=EA=E8=E9"=20=CE=C0=CE=20"=D1=EE=E1=E8=ED=E1=E0=ED=EA"=20=F0=E0=E4=20=EF=F0=E5=E4=F1=F2=E0=E2=E8=F2=FC?=
Subject: Ôèëèàë "Çàïàäí"Çàïàäíî-Ñèáèðñêèé" ÎÀÎ "Ñîáèíáàíê" ðàä
ïðåäñòàâèòü
=================================================================
Second example:
PHP hangs
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48289&edit=1