Results 1 to 4 of 4

Thread: email encoded with 'quoted-printable' don't display correctly

  1. #1
    sugarFLO is offline Sugar Community Member
    Join Date
    Jun 2009
    Posts
    45

    Exclamation email encoded with 'quoted-printable' don't display correctly

    Sugar does not display non-ASCII characters correctly in email encoded with:

    Content-transfer-encoding: Quoted-printable

    For example "Ä" is displayed as "=C4" (which is the correct encoding for that character).

    "Quoted-printable" is a very common and wide spread encoding type, so I'd be happy to see that fixed with the next patch!

  2. #2
    michaeka is offline Member
    Join Date
    May 2009
    Location
    Portland, OR
    Posts
    7

    Default Re: email encoded with 'quoted-printable' don't display correctly

    Know this is an old one but did this ever get resovled? Because I'm seeign the same thign in my 5.5.0 ondemand deployment

  3. #3
    sugarFLO is offline Sugar Community Member
    Join Date
    Jun 2009
    Posts
    45

    Default Re: email encoded with 'quoted-printable' don't display correctly

    It does not seem to be fixed...

    I found out, that the problem does only occur when the case of the email header differes

    Content-Type: text/plain; charset="iso-8859-1" (everything is fine)
    Content-type: text/plain; charset="iso-8859-1" (does not work)

    I guess this depends on the configuration of your email provider...

    I filed a bug under: #36729
    Last edited by sugarFLO; 2010-03-31 at 01:03 PM.

  4. #4
    sugarFLO is offline Sugar Community Member
    Join Date
    Jun 2009
    Posts
    45

    Default Re: email encoded with 'quoted-printable' don't display correctly

    Here comes a bugfix!

    Open the file modules/InboundEmail/inboundEmail.php

    After
    PHP Code:
    function getMessageText($msgNo$type$structure$fullHeader,$clean_email=true) {
    [...]
    $msgPart $text
    substitute:
    PHP Code:
    if(isset($decodedHeader['Content-Type']['charset']) && !empty($decodedHeader['Content-Type']['charset'])) {
                    
    $msgPart $this->handleCharsetTranslation($text$decodedHeader['Content-Type']['charset']);
                } 
    by:
    PHP Code:
    function array_change_key_case_recursive($input$case null){
                    if(!
    is_array($input)){
                        
    trigger_error("Invalid input array '{$array}'",E_USER_NOTICE); exit;
                    }
                    
    // CASE_UPPER|CASE_LOWER
                    
    if(null === $case){
                        
    $case CASE_LOWER;
                    }
                    if(!
    in_array($case, array(CASE_UPPERCASE_LOWER))){
                        
    trigger_error("Case parameter '{$case}' is invalid."E_USER_NOTICE); exit;
                    }
                    
    $input array_change_key_case($input$case);
                    foreach(
    $input as $key=>$array){
                        if(
    is_array($array)){
                        
    $input[$key] = array_change_key_case_recursive($array$case);
                        }
                    }
                    return 
    $input;
                } 
                
    $upperCaseKeyDecodeHearer =  array_change_key_case_recursive($upperCaseKeyDecodeHearer,CASE_UPPER);
                if(isset(
    $upperCaseKeyDecodeHearer[strtoupper('Content-Type')][strtoupper('charset')]) && !empty($upperCaseKeyDecodeHearer[strtoupper('Content-Type')][strtoupper('charset')])) {
                    
    $msgPart $this->handleCharsetTranslation($text$upperCaseKeyDecodeHearer[strtoupper('Content-Type')][strtoupper('charset')]);
                } 
    The point is, that SugarCRM looks for 'Content-Type' instead of a case-insensitive string.
    I reused the concept of the upper-cased header array from a few lines above (only we need a recursive function in order to upper-case a multi-dimensional array). Please note that $upperCaseKeyDecodeHearer is problably a typo of ~Header, but I used this from the original code.

    This bugfix is NOT upgrade-safe!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 2009-05-11, 11:31 AM
  2. Replies: 7
    Last Post: 2008-03-28, 07:01 PM
  3. Getting error: Failed to load encoded file
    By mongonv in forum Installation and Upgrade Help
    Replies: 1
    Last Post: 2007-10-08, 07:39 AM
  4. Replies: 0
    Last Post: 2006-01-24, 02:34 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •