Page MenuHomePhabricator

Incorrect order of elements in email subject when username is RTL
Closed, ResolvedPublic

Description

I've just received this e-mail, not sure if the subject is okay.

IMG_3298.PNG (1×750 px, 101 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Aklapper renamed this task from Weird e-mail subject when username is RTL to Incorrect order of elements in email subject when username is RTL.Mar 22 2016, 9:59 AM

Hi @Sjoerddebruin, thanks for taking the time to report this!

Does it display correctly in other email applications?
Could you provide the raw Subject header line from the email source?

Hi @Sjoerddebruin, thanks for taking the time to report this!

Does it display correctly in other email applications?
Could you provide the raw Subject header line from the email source?

Mail.app (default OS X application):

  • List of messages: wrong
  • Titlebar standalone window: wrong
  • Graphical message header: good

Screen Shot 2016-03-22 at 11.02.59.png (73×508 px, 24 KB)

Screen Shot 2016-03-22 at 11.03.33.png (528×961 px, 66 KB)

Raw subject:

?UTF-8?Q?=D7=9E=D7=A8=D7=9B=D7=96=20=D7=9E=D7=99=D7=93=D7=A2=20=D7=94=D7=A8=20=D7=94=D7=96=D7=99=D7=AA=D7=99=D7=9D=20heeft=20u=20bedankt=20voor=20uw=20bewerking=20op=20Wikidata?=

This is almost certainly a bug in your email client, but we may be able to get more email clients to behave well by using LRE/RLE characters. This will happen automatically once T121067: Write email formatter that uses presentation models is done.

Checked in betalabs. gmail still shows the reported issue:

Screen Shot 2016-05-24 at 8.40.46 AM.png (508×925 px, 63 KB)

Some other examples:
Screen Shot 2016-05-24 at 9.21.03 AM.png (525×936 px, 67 KB)

Screen Shot 2016-05-24 at 9.21.03 AM.png (525×936 px, 67 KB)

When a topic title is entirely in RTL - all seems to be correct:

Screen Shot 2016-05-24 at 9.24.03 AM.png (485×978 px, 64 KB)

We hoped it would be fixed by the @Catrope 's <bdi> work in the presentation models.

@Mooeypoo do you know what the problem is, based on the above screenshots?

We hoped it would be fixed by the @Catrope 's <bdi> work in the presentation models.

Not <bdi> actually, but LRE/RLE characters (Language::embedBidi()).

@Mooeypoo do you know what the problem is, based on the above screenshots?

You can see that it works correctly in the body, just not in the subject. So either we are not putting these LRE/RLE characters in the subject line, or gmail is stripping/ignoring them. Or maybe putting LRE/RLE in subject lines just doesn't work generally.

Here is email source example:

To: =?UTF-8?Q?=D7=A9=D7=99=D7=97=D7=AA=20=D7=95=D7=99=D7=A7=D7=99=D7=A4=D7=93=D7=99=20=D7=96=D7=A8=D7=99=D7=9E=D7=94?= <etonkovidova@wikimedia.org>
Subject: =?UTF-8?Q?=E2=80=AAET82=E2=80=AC=20replied=20in=20"=E2=80=AB=D7=96=D7=94=20=D7=90=D7=AA=D7=A8=20=D7=91=D7=93=D7=99=D7=A7=D7=95=D7=AA=20=D7=9C=D7=AA=D7=9B=D7=A0=D7=94=20=D7=A9=D7=9C=20=D7=95=D7=99=D7=A7=D7=99...=E2=80=AC".?=
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="=_5770874882495b72fb68d207c479b63f"
From: =?UTF-8?Q?=D7=95=D7=99=D7=A7=D7=99=D7=A4=D7=93=D7=99=D7=94?= <wiki@wikimedia.org>
Reply-To: No Reply <wiki@wikimedia.org>
Date: Tue, 24 May 2016 02:03:50 +0300
Message-ID: <hewiki.57438c56e90799.23181211@he.wikipedia.beta.wmflabs.org>
X-Mailer: MediaWiki mailer
List-Unsubscribe: <http://he.wikipedia.beta.wmflabs.org/wiki/%D7%9E%D7%99%D7%95%D7%97%D7%93:%D7%94%D7%A2%D7%93%D7%A4%D7%95%D7%AA>

--=_5770874882495b72fb68d207c479b63f
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8

=E2=80=AAET82=E2=80=AC replied in "=E2=80=AB=D7=96=D7=94 =D7=90=D7=AA=D7=A8=
 =D7=91=D7=93=D7=99=D7=A7=D7=95=D7=AA =D7=9C=D7=AA=D7=9B=D7=A0=D7=94 =D7=A9=
=D7=9C =D7=95=D7=99=D7=A7=D7=99...=E2=80=AC".

Looks like the email does contain LRE/RLE characters in the subject line, so this is probably a bug in GMail then. Does this work correctly in other email clients?

@Etonkovidova, were you able to answer Roan's question?

Does this work correctly in other email clients?

Checked in mail.com and mail.com in Mail app (Mac default mail client) - a subject line and the body text are correctly represented.
It seems as a genuine gmail bug

So, the gmail message with incorrect subject when forwarded

Screen Shot 2016-06-01 at 1.57.42 PM.png (472×879 px, 66 KB)

becomes correctly displayed in mail.com

Screen Shot 2016-06-01 at 1.52.38 PM.png (427×856 px, 48 KB)

The most interesting cases happen when the subject line is mixed with LTR words in the middle - the phrase will be displayed

How is this "resolved"?

This is fixed in most desktop email clients, it just isn't fixed in GMail. This is due to a bug in GMail, not in our code. So we've done what we can, and the remainder is a GMail issue.

(@Etonkovidova only included screenshots of the brokenness in GMail, but she showed me the same email in the Mac OS Mail application, and it looks good there.)

I tested in Thunderbird and it works well there, although we should really have quotes in this message. The HTML version uses bolding, but that is stripped in the plan text version.

thunderbird-rtl.png (401×857 px, 66 KB)

I just realized we now have the ability to have different messages for email subjects. We should use that for these kinds of messages regardless, because "Etonkovidova thanked you for your comment in Foo on Bar on Baz" is ambiguous without bolding, and we should add quotes there. But going beyond that, we could consider rewording some email subject lines to work around the GMail bug.