[Python-ideas] Fwd: Add Unicode-aware str.reverse() function?

Jonathan Fine jfine2358 at gmail.com
Sat Sep 8 09:41:27 EDT 2018


M.-A. Lemburg wrote:

> Most likely yes, but they would not render RTL text by first
> switching the direction and then printing them LTR again.
>
> Please also note that switching from LTR to RTL and back again
> is possible within a Unicode string, so applying str.reverse()
> would actually make things worse and not better :-)
>
> Processing in Unicode is always left to right, even if the resulting
> text may actually be rendered right to left or top to bottom.

> http://www.unicode.org/reports/tr9/
> https://www.w3.org/International/questions/qa-scripts

Your reminder of the difficulties in Unicode, and the URLs are much
appreciated. In particular, the keyword 'while' in Arabic should be
written Left-To-Right, even though the ambient text is Left-To-Right.

I've found these URLs, which suggests that there's a still a problem
to be solved.

https://www.linkedin.com/pulse/fix-rtl-right-left-support-persian-arabic-text-ubuntu-ghorbani/
https://askubuntu.com/questions/983480/showing-text-file-content-right-to-left-in-the-terminal
https://github.com/behdad/bicon

My understanding is that at present it's not straightforward to
provide legible localised text at the Python console, when the locale
language is Arabic, Persian, Hebrew or Urdu. (And another problem is
allow copy and paste of such text.)

If it is straightforward to provide RTL localisation at the Python
interpreter, I'd very much appreciate being pointed to such a
solution.

-- 
Jonathan


More information about the Python-ideas mailing list