简体   繁体   中英

Encoding issue in preheader in iphone native mail client

I have a problem with special characters in the preheader in iPhone 5. When I send the email shown below (code and headers taken from the hotmail webclient) it shows the special characters (æøå) correct in both subject and the body itself, however, when it's displayed in the preheader it shows ? so some sort of incorrect interpretation of the encoding.

The problem only occurs when opening the email in iPhone (tested with iphone 5) using the native mail client and only when it's linked to a hotmail account. If it's sent to any other acount eg gmail and opened in the same client it's rendered correctly. The problem has been reproduced on three different iPhones (two of which are running 7.1.2 I do not know what the last one is running).

In the example shown here the characters are html entities, in other tests I've tried with the actual characters with the same result. I've also tried without the meta headers, still same result.

The example is as basic as I can make it, I've tested with more realistic emails and have exactly the same issue.

Has anyone else seen a similar issue, or does anyone know what could cause this problem ?

Subject: =?utf-8?B?w6bDuMOl?=
Content-Type: multipart/mixed; 
    boundary="----=_Part_434_1665025495.1410355480247"
------=_Part_434_1665025495.1410355480247
Content-Type: multipart/alternative; 
    boundary="----=_Part_435_224090408.1410355480247"

------=_Part_435_224090408.1410355480247
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

=E6=F8=E5 ABC Webcopy text =09
[image]
Header =09
text =09
[image]
Header =09
text =09
[image]
Text =09
Unsubscribe text =09
------=_Part_435_224090408.1410355480247
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd" encoding="UTF-8">
<html encoding="UTF-8">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width">
  <meta name="format-detection" content="telephone=no">
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<body>
<div>
&#230;&#248;&#229; ABC Webcopy text
</div>
</html>
------=_Part_435_224090408.1410355480247--

------=_Part_434_1665025495.1410355480247--

Finally figured it out.

The preheader is taken from the text/plain version and not the html version, and the text/plain version was encoded as iso-8859-1 and not as the encoding header stated utf-8. After changing the content-encoding header everything worked perfectly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM