When opening an email using iOS mail I sometimes get broken html entities

925 views Asked by At

I am putting together a platform that sends emails automatically to users on a weekly basis. These emails are written in French which makes a heavy use of "special characters" such as é,à,ô,etc... Throughout all my tests, there was never any issues displaying any of these. We have tested the emails using litmus and every email is properly displayed.

Now that it is running in production, every now and then there are emails that "break" but only when opening the emails with iOS Mail on Apple mobile devices (iPhone5, iPhone 5s, iPhone 6).

An inspection of the raw data received confirms that UTF-8 is being used in the "From", the "Subject" and the body of the email:

...
From: =?utf-8?Q?=C3=89cole=20Dorval-Jean-XXIII?= <[email protected]>
Subject: =?utf-8?Q?Des=20nouvelles=20de=20l'=C3=89cole=20Dorval-Jean-XXIII?=
...
--_av-Nw6Vn3eClLo7C7y4Qxun-A
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.=w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=3D"http://www.w3.org/1999/xhtml">
...

What could be the cause of this and how do I fix it?

1

There are 1 answers

1
mlavoie On

After making many more tests and trying different combinations we have reached a conclusion:

The special characters within the body of the emails break whenever there are special characters in the From field of the email. Note that the special characters in the From field are themselves properly displayed.

This seems to be an issue with iOS Mail on Apple mobile devices. The solution is to systematically convert "special characters" within the body of the email into their encoded equivalent:

ê => &ecirc;     è => &egrave;     é => &eacute;
â => &acirc;     à => &agrave;     
ô => &ocirc;
etc...