[imp] terminate UTF7-IMAP string in US-ASCII state

Wenzhuo Zhang wenzhuo at zhmail.com
Mon May 24 01:16:28 PDT 2004


Hi,

The following two liner patch makes sure that UTF7-IMAP strings always
end in US-ASCII state as required by RFC2060.

--- imp-3.2.3/lib/IMP.php	2004-01-28 16:38:09.000000000 +0800
+++ imp-3.2.3/lib/IMP.php.utf7-imap	2004-05-24 16:10:38.000000000 +0800
@@ -1265,7 +1265,8 @@
         /* First try iconv with transliteration. */
         if (extension_loaded('iconv')) {
             ini_set('track_errors', 1);
-            $output = @iconv($charset, 'UTF7-IMAP', $input);
+            $output = @iconv($charset, 'UTF7-IMAP', $input . 'a');
+            $output = substr($output, 0, -1);
             if (isset($php_errormsg)) {
                 $output = false;
             }
-- 
Wenzhuo
  GnuPG Key ID 0xBA586A68
  Key fingerprint = 89C7 C6DE D956 F978 3F12  A8AF 5847 F840 BA58 6A68


More information about the imp mailing list