Jump to:

23471 Posts in 18941 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Encoding problem with email subject line

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2037 Views
  • cliersch
    Community Member
    75 Posts

    Encoding problem with email subject line Link to this post

    Hi! Does anybody knows about the email function and the encoding problem?

    I've got a problem with the encoding of the subject line of my send emails.

    It's possible to send an email in utf-8. The body of the email is correctly encoded.
    But it's not working for the "subject" header of the email. I'm receiving broken encoding.

    Something might be wrong with the email header.

    Any idea?

  • denisrosset
    Community Member
    4 Posts

    Re: Encoding problem with email subject line Link to this post

    Dear all,

    I am having the same issue. I don't understand which encoding to use to send email subjects from Silverstripe.

    As a temporary measure, I use the following function to remove most common French characters, but I would like to know how to proceed.

    Warm regards,


       function removeAccents($remove_from)
          // Remove all instances of accents
          $accent_array = array('e' => array('é','è','ê','ë'),
           'E' => array('É','È','Ê','Ë'),
           'a' => array('á','à','â','ä','Ã¥'),
           'A' => array('Á','À','Â','Ä','Ã…'),
           'i' => array('ï','ì','î'),
           'I' => array('Ï','ÃŒ','ÃŽ'),
           'o' => array('ö','ô','ò'),
           'O' => array('Ö','Ô','Ã’'),
           'u' => array('ü','û','ù'),
           'U' => array('Ãœ','Û','Ù')
          foreach($accent_array as $acc_key => $acc_val_array)
                $reg_exp_accent = '';// clear regular expression var
                      $reg_exp_accent .= $acc_val_array[$m].'|';// create the regular expression var
                $reg_exp_accent = substr_replace($reg_exp_accent,"",-1);// remove last '|'
                $remove_from = ereg_replace($reg_exp_accent,$acc_key,$remove_from);
          return $remove_from;

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.