ID: 45213 User updated by: thomas dot jarosch at intra2net dot com Reported By: thomas dot jarosch at intra2net dot com -Status: Verified +Status: Closed Bug Type: IMAP related Operating System: * PHP Version: 5.*, 6CVS (2009-04-27) New Comment:
Sounds good. Thanks! Previous Comments: ------------------------------------------------------------------------ [2009-05-02 18:03:40] paj...@php.net I added imap_utf8_to_mutf7 and imap_mutf7_to_utf8 to php 5.3 and 6.0. 5.2 can't accept new features, you can easily backport the two functions from 5.3. However I won't fix the utf7_encode/decode functions as they should actually use the imap API and UTF-8. ------------------------------------------------------------------------ [2009-04-28 07:53:49] thomas dot jarosch at intra2net dot com As far as I know, iconv does not support IMAP modified UTF7 out of the box. Atleast my version 1.9.1 does not and I have a patch for exactly that. Though we can't rely on people having a patched iconv version. The c-client IMAP library has support for UTF8 <-> modified UTF7. Maybe that would be an option? ------------------------------------------------------------------------ [2009-04-27 20:31:15] paj...@php.net Should we not simply rely on iconv in 5.2/5.3 and ICU in HEAD? ------------------------------------------------------------------------ [2009-04-27 19:07:23] j...@php.net 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";' ------------------------------------------------------------------------ [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