Bug #15630: imap_utf7_decode appears to be broken

From: Date: Tue, 19 Feb 2002 20:56:24 +0000
Subject: Bug #15630: imap_utf7_decode appears to be broken
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-613@lists.php.net to get a copy of this message
From: robert.marchand@umontreal.ca Operating system: SGI Irix 6.5 PHP version: 4.1.1 PHP Bug Type: IMAP related Bug description: imap_utf7_decode appears to be broken Hi, when trying to use the IMP Webmail client with an Exchange 2000 Server, folders with accents in the name are mangled. It appears that the Exchange Imapd server sends modified utf-7 names as explained in rfc 2060. IMP use a call to the imap_utf7_decode function. It should work but it does'nt. Here's a sample: What Exchange send: "&AMk-l&AOk-ments envoy&AOk-s" What it means: Éléments envoyés. What IMP show: <nothing> My setting is: SGI Irix 6.5 Imap-2001a PHP 4.1.1 IMP 2.2.7 I have setup a small script that show the problem: <?php error_reporting(63); $folder = '&AMk-l&AOk-ments envoy&AOk-s'; $plain = 'Boîte de réception'; $unicode = mb_convert_encoding($plain, "UNICODE", "ISO-8859-1"); $br = "<br>"; echo "<html><head><title>test UTF7</title></head><body>"; echo "folder (modified UTF-7): ", $folder, $br; echo "plain (Latin1): ", $plain, $br, $br; echo "<strong>mb_convert_encoding test</strong>", $br; $test = mb_convert_encoding($folder, "auto", "UTF7-IMAP"); echo " folder decoded: ", $test, $br; $test = mb_convert_encoding($test, "UTF7-IMAP", "ISO-8859-1"); echo " encoded again: ", $test, $br; $test = mb_convert_encoding($test, "auto", "UTF7-IMAP"); echo " decoded again: ", $test, $br, $br; $test = mb_convert_encoding($plain, "UTF7-IMAP", "ISO-8859-1"); echo " plain encoded: ", $test, $br; $test = mb_convert_encoding($test, "auto", "UTF7-IMAP"); echo " decoded: ", $test, $br, $br; echo "<strong>imap_utf7_decode test</strong>", $br; $test = imap_utf7_decode($folder); echo "folder decoded: ", $test, $br; $test = imap_utf7_encode($test); echo " encoded again: ", $test, $br; $test = imap_utf7_decode($test); echo " decoded again: ", $test, $br, $br; $test = imap_utf7_encode($plain); echo " plain encoded: ", $test, $br; //$test = imap_utf7_encode($unicode); //echo "unicode encoded: ", $test, $br; $test = imap_utf7_decode($test); echo " decoded: ", $test, $br; echo "</body></html>"; ?> And here is the output: folder (modified UTF-7): &AMk-l&AOk-ments envoy&AOk-s plain (Latin1): Boîte de réception mb_convert_encoding test folder decoded: Éléments envoyés encoded again: &AMk-l&AOk-ments envoy&AOk-s decoded again: Éléments envoyés plain encoded: Bo&AO4-te de r&AOk-ception decoded: Boîte de réception imap_utf7_decode test folder decoded: Ælàments envoyàs encoded again: &A8l-l&A+p-ments envoy&AfM-s decoded again: Àlùments envoyðs plain encoded: Bo&7s-te de r&6g-ception decoded: Boïte de rîception -------------- As you see I've found a work around by using the function mb_convert_encoding. Is imap_utf7_* really broken or what? Thanks. -- Edit bug report at http://bugs.php.net/?id=15630&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15630&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15630&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15630&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15630&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15630&r=support Expected behavior: http://bugs.php.net/fix.php?id=15630&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15630&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15630&r=submittedtwice

« previous php.bugs (#613) next »