Results 1 to 3 of 3

Thread: latin characters show in subject but not in email body

  1. #1
    dbarajas is offline Sugar Community Member
    Join Date
    Apr 2006
    Posts
    12

    Exclamation latin characters show in subject but not in email body

    When receiving an email with spanish characters (ISO-8859-1 encoding) the characters
    do not show up correctly in the email BODY. Instead of "camión" I get "cami?".

    However, they do show up correctly in the SUBJECT.

    I found this thread in the Portuguese forum:
    http://www.sugarcrm.com/forums/showt...ght=ISO-8859-1
    and talks about putting a script by using escape sequences, but I have no idea where to put it.

    Is there something that I have not configured correctly or is this a bug that needs to be reported?

    I'm using 4.2.

    Thanks

  2. #2
    racetech is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    51

    Default Re: latin characters show in subject but not in email body

    Hi,


    If disable two lines: 1155 and 1175 of file /modules/InboundEmail/InboundEmail.php


    this:

    $file = utf8_decode($file);//cleanses encoding safely

    to:

    //$file = utf8_decode($file);//cleanses encoding safely



    for me solve the problem, Sugar 4.2

    best regards

  3. #3
    dbarajas is offline Sugar Community Member
    Join Date
    Apr 2006
    Posts
    12

    Default Re: latin characters show in subject but not in email body

    Here's another solution:

    Instead of removil the utf8_decode() lines I added the following function:
    PHP Code:
    function translate_dfb($txt){

            
    $txt str_replace("á""á"$txt);
            
    $txt str_replace("Á""Á"$txt);
            
    $txt str_replace("à""à"$txt);
            
    $txt str_replace("À""À"$txt);

            
    $txt str_replace("é""é"$txt);
            
    $txt str_replace("É""É"$txt);
            
    $txt str_replace("è""è"$txt);
            
    $txt str_replace("È""È"$txt);

            
    $txt str_replace("í""í"$txt);
            
    $txt str_replace("Í""Í"$txt);
            
    $txt str_replace("ì""ì"$txt);
            
    $txt str_replace("Ì""Ì"$txt);

            
    $txt str_replace("ó""ó"$txt);
            
    $txt str_replace("Ó""Ó"$txt);
            
    $txt str_replace("ò""ò"$txt);
            
    $txt str_replace("Ò""Ò"$txt);

            
    $txt str_replace("ú""ú"$txt);
            
    $txt str_replace("Ú""Ú"$txt);
            
    $txt str_replace("ù""ù"$txt);
            
    $txt str_replace("Ù""Ù"$txt);

            
    $txt str_replace("ñ""ñ"$txt);
            
    $txt str_replace("Ñ""Ñ"$txt);

            return 
    $txt;

    It should be called before thr utf8_decode():
    PHP Code:
       $file $str;
       
    $file translate_dfb($file);
       
    $file utf8_decode($file); // cleanses encoding safely 
    However, when an e-mail is sent (at least with Mozilla/Thunderbird) the ISO encoding is used like this:

    "vénde esto pues"
    Subject: =?ISO-8859-1?Q?v=E9nde_esto_pues?=
    Since the first word is in ISO it is correctly translated by the
    imap_mime_header_decode() function

    However, if the subject begins with a word without accents:

    "que onda cómo estás tu"
    Subject: que onda =?ISO-8859-1?Q?c=F3mo_est=E1s_tu?=

    The subject is composed by "default" text and by "ISO-8859-1" text, therefore the function imap_mime_header_decode() will decode it in two elements of an array.

    Sugar does use only the First array:
    PHP Code:
    $email->name                    $subjectDecoded[0]->text
    in this case the words: "que onda". The rest of the subject is stored in the next element of the array. So by adding the following lines both pieces are put together as one Subject:
    PHP Code:

    if (isset($subjectDecoded[1]->text) && !empty($subjectDecoded[1]->text)) {
        
    $email->name                    .= $subjectDecoded[1]->text;


Thread Information

Users Browsing this Thread

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

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
  •