Changeset 1787 in subversion


Ignore:
Timestamp:
Sep 13, 2008 2:57:37 PM (5 years ago)
Author:
thomasb
Message:

Fix broken quoted-printable encoding

Location:
trunk/roundcubemail/program/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/main.inc

    r1775 r1787  
    644644{ 
    645645  $out = html_entity_decode(html_entity_decode($content)); 
    646   $out = preg_replace('/\\\([a-z0-9]{4})/ie', "chr(hexdec('\\1'))", $out); 
     646  $out = preg_replace('/\\\([0-9a-f]{4})/ie', "chr(hexdec('\\1'))", $out); 
    647647  $out = preg_replace('#/\*.*\*/#Um', '', $out); 
    648648  return $out; 
  • trunk/roundcubemail/program/include/rcube_mail_mime.php

    r1772 r1787  
    142142 
    143143        //This header contains non ASCII chars and should be encoded. 
    144         if (preg_match('#[\x00-\x1F\x80-\xFF]{1}#', $value)) { 
     144        if (preg_match('/[\x80-\xFF]{1}/', $value)) { 
    145145          $suffix = ''; 
    146146          // Don't encode e-mail address 
     
    161161            // quoted-printable encoding has been selected 
    162162            $mode = 'Q'; 
    163             $encoded = preg_replace('/([\x3F\x00-\x1F\x80-\xFF])/e', "'='.sprintf('%02X', ord('\\1'))", $value); 
    164             // replace spaces with _ 
    165             $encoded = str_replace(' ', '_', $encoded); 
     163            // replace ?, =, _ and spaces 
     164            $encoded = str_replace(array('=','_','?',' '), array('=3D','=5F','=3F','_'), $value); 
     165            $encoded = preg_replace('/([\x80-\xFF])/e', "'='.sprintf('%02X', ord('\\1'))", $encoded); 
    166166          } 
    167167 
Note: See TracChangeset for help on using the changeset viewer.