Steven D'Aprano <[email protected]> added the comment:
Works for me:
>>> chr(1839)+'1'
'ܯ1'
You are mixing a right-to-left code point (DHALATH) with a left-to-right code
point (digit 1). The result depends on the quality of your console or terminal.
Try using a different terminal.
On my system, the terminal displays the DHALATH on the left, and the digit 1 on
the right; when pasted into my browser, it displays them in the reverse order.
I don't know which is correct: bidirectional text is complex and I don't know
the rules for mixing characters with different bidirection classes.
But whichever display is correct, this has nothing to do with Python. It
depends on the quality of the bidirectional text rendering of the browser and
the terminal.
If your terminal displays the wrong results, that's a bug in the terminal. What
terminal are you using, in what OS? Try using a different terminal.
You can check that Python is doing the right thing:
>>> s = chr(1839)+'1'
>>> s == '\N{SYRIAC LETTER PERSIAN DHALATH}1'
True
If your system reports True, then Python has made the string you asked for, and
the result of printing depends on the capabilities of the terminal, and the
available glyphs in the typeface used by the terminal. There's nothing Python
can do about that.
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42290>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com