Changeset 2334 in subversion


Ignore:
Timestamp:
Mar 6, 2009 3:52:21 PM (4 years ago)
Author:
alec
Message:
  • Use US-ASCII as failover when Unicode searching fails (#1485762) only US-ASCII is a must-have charset from IMAP's RFC
Location:
trunk/roundcubemail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r2333 r2334  
    22=========================== 
    33 
     4- Use US-ASCII as failover when Unicode searching fails (#1485762) 
    45- Fix errors handling in IMAP command continuations (#1485762) 
    56- Fix FETCH result parsing for servers returning flags at the end of result (#1485763) 
  • trunk/roundcubemail/program/include/rcube_imap.php

    r2291 r2334  
    956956    $results = $this->_search_index($mailbox, $str, $charset, $sort_field); 
    957957 
    958     // try search with ISO charset (should be supported by server) 
     958    // try search with US-ASCII charset (should be supported by server) 
    959959    // only if UTF-8 search is not supported 
    960     if (empty($results) && !is_array($results) && !empty($charset) && $charset!='ISO-8859-1') 
    961       { 
    962         // convert strings to ISO-8859-1 
     960    if (empty($results) && !is_array($results) && !empty($charset) && $charset!='US-ASCII') 
     961      { 
     962        // convert strings to US_ASCII 
    963963        if(preg_match_all('/\{([0-9]+)\}\r\n/', $str, $matches, PREG_OFFSET_CAPTURE)) 
    964964          { 
     
    968968            $string_offset = $m[1] + strlen($m[0]) + 4; // {}\r\n 
    969969            $string = substr($str, $string_offset - 1, $m[0]); 
    970             $string = rcube_charset_convert($string, $charset, 'ISO-8859-1'); 
     970            $string = rcube_charset_convert($string, $charset, 'US-ASCII'); 
     971            if (!$string) continue; 
    971972            $res .= sprintf("%s{%d}\r\n%s", substr($str, $last, $m[1] - $last - 1), strlen($string), $string); 
    972973            $last = $m[0] + $string_offset - 1; 
     
    978979          $res = $str; 
    979980           
    980         $results = $this->search($mbox_name, $res, 'ISO-8859-1', $sort_field); 
     981        $results = $this->search($mbox_name, $res, '', $sort_field); 
    981982      } 
    982983 
Note: See TracChangeset for help on using the changeset viewer.