Something strange I just noticed, when playing around with bidirectional Unicode text. If you haven’t seen bidirectional (“bidi”) text, it’s weird. This is the part of Unicode that deals with right-to-left scripts, like Hebrew, and their insanely complicated interactions with left-to-right text.
Consider the five characters stored in sequence:
“ר” then ” ” then “∈” then ” ” then “מ”
I separated them with English words so your browser’s bidi doesn’t touch them yet. These five characters might appear in a Hebrew maths paper (?), to mean “ר is a member of the set מ”, much like “x ∈ s” means “x is a member of the set s”.
Let’s render this out:
ר ∈ מ
If your browser is doing what mine is (Firefox 3), you’ll see that as Hebrew dictates, the five characters are written from right to left (the spaces and “∈” are neutrals, so they take the directionality of the surrounding text, so count as right-to-left characters in this instance). What I’m amazed by is that on my display, the “∈” (U+2208) has actually been rendered flipped horizontally, so as to correctly read that “ר is a member of the set מ” even though “ר” is on the right of the operator. It’s been rendered as a “∋” (U+220B). I’m not sure if it’s specifically rendering U+220B instead of U+2208, or if it’s actually flipping the U+2208 glyph horizontally. I can’t find any mention of horizontal flipping in the bidi spec.
Can anyone explain what’s going on?
(Note: I doubt Hebrew-speaking mathematicians use Hebrew characters as variable names; it was just an example.)