ID: 45213
Updated by: [email protected]
Reported By: thomas dot jarosch at intra2net dot com
-Status: Open
+Status: Verified
Bug Type: IMAP related
-Operating System: linux
+Operating System: *
-PHP Version: 5.2.6
+PHP Version: 5.*, 6CVS (2009-04-27)
New Comment:
Here is short and reliable test:
# sapi/cli/php -r '$tst = mb_convert_encoding("täst", "ISO-8859-1",
"UTF8"); echo $tst, "\n"; echo imap_utf7_encode($tst), "\n",
mb_convert_encoding($tst, "UTF7-IMAP", "ISO-8859-1"), "\n";'
Previous Comments:
------------------------------------------------------------------------
[2008-06-09 13:17:53] thomas dot jarosch at intra2net dot com
Description:
------------
Hello together,
I tried to encode german umlauts using imap_utf7_encode(),
but the computed string is not understood by the cyrus IMAP server.
This is pretty much related to bug #15630, but now I had the
help of a coworker who is pretty fast decoding base64 by hand :-)
UTF-7 is defined to encode special characters as two byte UTF-16
stream.
Normally the ISO-8859-1 string "täst" should be encoded into t&AOQ-st,
which corresponds to 0x00, 0xe4.
The current code in PHP 5.2.6 encodes it to t&5A-st,
which is 0xe4 without the leading 0x00.
Would be nice if that could be resolved since it's
not compatible with most IMAP implementations.
Bug #15630 is around since 2002.
Cheers,
Thomas
Reproduce code:
---------------
echo imap_utf7_encode("täst");
Expected result:
----------------
t&AOQ-st
Actual result:
--------------
t&5A-st
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45213&edit=1