0

I have a word with a special character in it that does not display properly in the subject line of an email (via mail()).

The word is O’Conner and the special character is ’

"as is" the word appears as O’Conner in the subject line of the incoming email message.

When I use html_entities_decode()the word appears as O’Conner in the subject line of the incoming email message.

When I use mb_encode_mimeheader("O’Conner", "UTF-8", "Q") the word appears as O’Conner in the subject line of the incoming email message.

Is there a way to get the word to appear is it should?

H. Ferrence
  • 7,906
  • 31
  • 98
  • 161
  • Make sure you send the email as UTF-8 encoded and that all your PHP files also are stored as UTF-8. – M. Eriksson Jun 18 '21 at 16:01
  • Yeah, that link to the other supposed SO answer does not work. `mb_encode_mimeheader("O'Conner", 'UTF-8', 'Q')` does not do the trick! – H. Ferrence Jun 18 '21 at 16:29
  • If it shows “O’Conner”, that’s because the string is *actually* “O’Conner”. If you don’t want it to include an HTML entity, then don’t put one in it. Why is it HTML encoded in the first place? HTML-decode it if you have to, as you’ve already tried. – deceze Jun 18 '21 at 17:01

0 Answers0