Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

On this answer, it looks like the user entered some Arabic text, and it caused the comment text and the timestamp to switch places:


share|improve this question
As an aside: on my Chrome on a Mac it renders the full time to the left. – Arjan Mar 22 '11 at 18:55
Ah, I'm using Firefox 3.6.15. I know nothing about handling foreign languages, I didn't know it was a browser thing. – Brandon Mar 22 '11 at 19:01
Well, the browser shouldn't matter, of course :-) – Arjan Mar 22 '11 at 19:03
@Ben I think it was fixed at some point and we can't cause this behavior. – Shadow Wizard Oct 13 '14 at 7:08
@ShadowWizard Parts of it are still reproducible. – Adam Lear Oct 13 '14 at 23:01
up vote 6 down vote accepted

Getting mixed LTR and RTL text to play together nicely is difficult. The comment is in Arabic, and the numbers then stay in RTL (because there's no way for the renderer to know if they're part of the RTL text or not) until the renderer sees text that must be LTR. It might work better if SO emitted a Unicode LTR shift before its boilerplate.

share|improve this answer
Well I take it since Jeff removed the bug tag, that is not going to happen :P – Brandon Mar 23 '11 at 5:09

While this bug has been partially fixed by adding the dir="ltr" attribute to the comment timestamps, so that the timestamp is no longer broken up, using RTL text (and especially the Unicode BiDi override characters) in comments can still mess up the placement of the username and the timestamp with respect to the comment text, as the sandbox thread linked by balpha above well demonstrates:

Screenshot without fix

One way to fix this issue would be to forbid RTL text (or at least RTL control characters1) in comments. However, that would be throwing the baby out with the bathwater — there are legitimate reasons for writing, say, Hebrew or Arabic text in comments, and indeed there are some SE sites (like, say, Mi Yodeya or Islam) where such comments may even be fairly common.

Instead, the proper way to fix this issue is to isolate the directionality comment text (and the username) from the surrounding elements using the unicode-bidi: isolate CSS property. That way, users can write their comments in any language and text directionality they want, and it won't mess up the surrounding content.

Unfortunately, browser support for this relatively new CSS feature is still quite limited, so, for the time being, we're also going to need some vendor prefixes and a fallback to unicode-bidi: embed (which doesn't fully protect from deliberate BiDi override hacks1, but is better than nothing). I thus propose that the following CSS rule should be added to the SE style sheet:

.comment-copy, .comment-user {
    unicode-bidi: embed;           /* fallback for browsers that don't support isolate */
    unicode-bidi: -moz-isolate;
    unicode-bidi: -webkit-isolate;
    unicode-bidi: isolate;

With this CSS rule, the comments shown above look like this:

Screenshot after fix

(This rule will also be included in the next version of the Stack Overflow Unofficial Patch user script.)

1) I would, in fact, support the blocking / filtering of the Explicit Directional Override characters LRO (U+202D) and RLO (U+202E) in comments, since they have very few if any legitimate uses and a high abuse potential. Even the Unicode consortium nowadays says that "they are to be avoided wherever possible, because of security concerns."

share|improve this answer
Thanks for doing all the legwork... This will be live in the next build. :) – Adam Lear Oct 13 '14 at 23:16
Unfortunately I had to revert this change since it introduced a number of problems in Safari and the "win" achieved here by trying to get it working is fairly minor. – Adam Lear Nov 22 '14 at 17:24

The entire line is right to left instead of left to right.

share|improve this answer
The entire line? Not in the screenshot. – Arjan Mar 22 '11 at 18:58
@Arjan, I mean the time is displayed first, then user, then dash, then comment as opposed the reverse which is normal. The screenshot seems to be from something other than Chrome, which I am using to view the comment. – jzd Mar 22 '11 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .