Disordered text with LTR and RTL (RTL nickname)
Bug description
When using an Arabic (or other nickname that starts with RTL characters) and a sentence contains LTR and RTL, the characters are disordered.
Steps to reproduce
- Replace [%H:%M] with [%X] for time_stamp at ACE, so that it will not contain LTR characters (i.e. AM or PM), or just enter an RTL character at the start.
- Use an RTL nickname like جماهيرية.
- The alignment will always be from left.
- Mix a sentence with LTR and RTL.
- The sentence is disordered.
Solution
Detecting LTR or RTL characters. When a sentence starts with RTL characters, use (one of the two):
- U+200F RIGHT-TO-LEFT MARK (RLM)
- U+202B RIGHT-TO-LEFT EMBEDDING (RLE) When a sentence starts with LTR characters, use (one of the two):
- U+200E LEFT-TO-RIGHT MARK (LRM)
- U+202A LEFT-TO-RIGHT EMBEDDING (LRE) in order to force a correct order.