This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients ezio.melotti, steven.daprano, vstinner, xxm
Date 2020-11-08.07:28:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1604820484.13.0.235508765677.issue42290@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-11-08 07:28:04steven.dapranosetrecipients: + steven.daprano, vstinner, ezio.melotti, xxm
2020-11-08 07:28:04steven.dapranosetmessageid: <1604820484.13.0.235508765677.issue42290@roundup.psfhosted.org>
2020-11-08 07:28:04steven.dapranolinkissue42290 messages
2020-11-08 07:28:03steven.dapranocreate