[Svn] r2334 - in trunk/roundcubemail: . program/include

trac at roundcube.net trac at roundcube.net
Fri Mar 6 21:52:22 CET 2009


Author: alec
Date: 2009-03-06 14:52:21 -0600 (Fri, 06 Mar 2009)
New Revision: 2334

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/include/rcube_imap.php
Log:
- Use US-ASCII as failover when Unicode searching fails (#1485762)
  only US-ASCII is a must-have charset from IMAP's RFC


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2009-03-06 18:49:38 UTC (rev 2333)
+++ trunk/roundcubemail/CHANGELOG	2009-03-06 20:52:21 UTC (rev 2334)
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Use US-ASCII as failover when Unicode searching fails (#1485762)
 - Fix errors handling in IMAP command continuations (#1485762)
 - Fix FETCH result parsing for servers returning flags at the end of result (#1485763)
 - Fix datetime columns defaults in mysql's DDL (#1485641)

Modified: trunk/roundcubemail/program/include/rcube_imap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap.php	2009-03-06 18:49:38 UTC (rev 2333)
+++ trunk/roundcubemail/program/include/rcube_imap.php	2009-03-06 20:52:21 UTC (rev 2334)
@@ -955,11 +955,11 @@
 
     $results = $this->_search_index($mailbox, $str, $charset, $sort_field);
 
-    // try search with ISO charset (should be supported by server)
+    // try search with US-ASCII charset (should be supported by server)
     // only if UTF-8 search is not supported
-    if (empty($results) && !is_array($results) && !empty($charset) && $charset!='ISO-8859-1')
+    if (empty($results) && !is_array($results) && !empty($charset) && $charset!='US-ASCII')
       {
-	// convert strings to ISO-8859-1
+	// convert strings to US_ASCII
         if(preg_match_all('/\{([0-9]+)\}\r\n/', $str, $matches, PREG_OFFSET_CAPTURE))
 	  {
 	  $last = 0; $res = '';
@@ -967,7 +967,8 @@
 	    {
 	    $string_offset = $m[1] + strlen($m[0]) + 4; // {}\r\n
 	    $string = substr($str, $string_offset - 1, $m[0]);
-	    $string = rcube_charset_convert($string, $charset, 'ISO-8859-1');
+	    $string = rcube_charset_convert($string, $charset, 'US-ASCII');
+	    if (!$string) continue;
 	    $res .= sprintf("%s{%d}\r\n%s", substr($str, $last, $m[1] - $last - 1), strlen($string), $string);
 	    $last = $m[0] + $string_offset - 1;
 	    }
@@ -977,7 +978,7 @@
 	else // strings for conversion not found
 	  $res = $str;
 	  
-	$results = $this->search($mbox_name, $res, 'ISO-8859-1', $sort_field);
+	$results = $this->search($mbox_name, $res, '', $sort_field);
       }
 
     $this->set_search_set($str, $results, $charset, $sort_field);

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list