4

In the list of stars on the right-hand side of the chat room, the fairly recent posts are listed as having been posted "- 2d ago" (=two days ago) or "- 15m ago" (=fifteen minutes ago).

In my browser (Firefox 14.0.1 for Ubuntu), at least, the initial "- 1" or "- 15", if it appears after a right-to-left quotation of a chat post, also appears right-to-left, thus showing up on the left side of the text of the chat post.

I can think of two ways to fix this:

  • Add lang='en' dir='ltr' to the <html> tag. Then, the Unicode bidirectional algorithm should interpret the (directionally neutral) hyphen-space-numeral as left-to-right. (Because it's between a right-to-left and a left-to-right character, it follows the ambient direction.)
  • Add a left-to-right mark (U+200E) immediately before the "- 1" (before the hyphen), forcing the hyphen-space-numeral to be between two left-to-right characters and thus left-to-right.

The latter seems a surer bet (viz, that it will work in more browsers) to me.

| |
  • Almost positive I've seen this issue discussed somewhere here or on MSO – Double AA Aug 1 '12 at 18:49
  • Also happens in FF 14.0.1 on Mac. – Monica Cellio Aug 1 '12 at 18:52
  • Yeah, we've seen that a few times, but that was when people were joking around with RTL switching unicode. This is actually the first valid use case that I know of. At least assuming that message is actually meaningful. I don't know Hebrew :) – balpha Aug 1 '12 at 18:57
  • 2
    @balpha, yeah, the message is fine. :-) – msh210 Aug 1 '12 at 18:59
  • @balpha Interesting, I was considering posting this a couple months ago, but after I saw all the meta.SO posts, I assumed it was pointless... – Hod - Monica's Army Aug 6 '12 at 15:18
  • More comments on this are at chat.stackexchange.com/transcript/message/10502087#10502087 et seq. – msh210 Jul 26 '13 at 6:53
  • Very similar: meta.judaism.stackexchange.com/q/4248 – msh210 Mar 5 '17 at 9:36
1

Using @msh210's suggested method, I have written a jQuery proof of concept that accomplishes this locally, until such time as the devs fix this.

I've added the code to my chat room userscript, which is available here.

For the technically minded:

function bidi(){
    reg = /[\p{InHebrew}\p{InArabic}]/;
    $.each($('[id^=summary_]'), function(i, star){
        reg.test($(star).html()) && $(star).html($(star).html().replace(/ - <a/, ' &lrm;- <a'));
    });
}
| |
  • +1, but I think you can omit the .test and just do the replacement. Otoh, I don't know if that'd be a help or a hindrance. – msh210 Jul 26 '13 at 16:45
  • @msh210 I didn't know if adding &lrm; to every message was necessary or would cause problems. If it's harmless, than I guess the test is just superfluous. – Hod - Monica's Army Jul 26 '13 at 17:21

You must log in to answer this question.

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