From: wiela at centras dot lt
Operating system: Windows XP HE
PHP version: 5.2.5
PHP Bug Type: ICONV related
Bug description: iconv_mime_encode(), broken Q scheme
Description:
------------
iconv_mime_encode(),'Q' encoding scheme isn't reliable and
sometimes (for particular character and/or string length combination?)
returns: "Notice: iconv_mime_encode(): Unknown error (7) in ..."
*without any result*.
This also applies to earlier php versions (tested with php 5.2.1).
Reproduce code:
---------------
$preferences = array(
"input-charset" => "UTF-8",
"output-charset" => "UTF-8",
"line-length" => 76,
"line-break-chars" => "\n",
"scheme" => "Q"
);
// $str1 results error, it's utf-8 string, its base64_encode() is:
//'xIXEjcSZxJfEr8WhxbPFviDEr8SZxI3FocWzxJnEr8SFIMSNxJnFs8SFxaHFs8Wr'
$str1 = "ąčęėįų
įęčųęįą
čęųąųū";
// $str2 doesn't result error, although it's only one character
// shorter. It's utf-8 string, its base64_encode() is:
//'xIXEjcSZxJfEr8WhxbPFviDEr8SZxI3FocWzxJnEr8SFIMSNxJnFs8SFxaHFsw=='
$str2 = "ąčęėįų
įęčųęįą
čęųąų";
echo iconv_mime_encode("Subject", $str1, $preferences);
echo iconv_mime_encode("Subject", $str2, $preferences);
Expected result:
----------------
Well, at least any (*some*) result is expected, without any
errors and warnings.
For $str1 is expected:
Subject: =?UTF-8?Q?=C4=85=C4=8D=C4=99=C4=97=C4=AF=C5=A1=C5=B3?=
=?UTF-8?Q?=C5=BE=20=C4=AF=C4=99=C4=8D=C5=A1=C5=B3=C4=99=C4=AF?=
=?UTF-8?Q?=C4=85=20=C4=8D=C4=99=C5=B3=C4=85=C5=A1=C5=B3=C5=AB?=
For $str2 is expected:
Subject: =?UTF-8?Q?=C4=85=C4=8D=C4=99=C4=97=C4=AF=C5=A1=C5=B3?=
=?UTF-8?Q?=C5=BE=20=C4=AF=C4=99=C4=8D=C5=A1=C5=B3=C4=99=C4=AF?=
=?UTF-8?Q?=C4=85=20=C4=8D=C4=99=C5=B3=C4=85=C5=A1=C5=B3?=
Actual result:
--------------
For $str1:
FALSE with "Notice: iconv_mime_encode(): Unknown error (7) in ..."
For $str2:
Subject: =?UTF-8?Q?=C4=85=C4=8D=C4=99=C4=97=C4=AF=C5=A1=C5=B3?=
=?UTF-8?Q?=C5=BE=20=C4=AF=C4=99=C4=8D=C5=A1=C5=B3=C4=99=C4=AF?=
=?UTF-8?Q?=C4=85=20=C4=8D=C4=99=C5=B3=C4=85=C5=A1=C5=B3?=
--
Edit bug report at http://bugs.php.net/?id=43314&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43314&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43314&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43314&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43314&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43314&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43314&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43314&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43314&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43314&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43314&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43314&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43314&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43314&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43314&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43314&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43314&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43314&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43314&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43314&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43314&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43314&r=mysqlcfg