On Sat, Sep 8, 2018 at 11:41 PM, Jonathan Fine <jfine2...@gmail.com> wrote: > 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. >
Generally, problems with RTL text are *display* problems, and are not solved by reversing strings. I've hardly ever needed to reverse a string, and when it does happen, it's generally for the sake of *parsing*. You reverse a string, parse it from left to right, then reverse the result, in order to do a "parse from the right" operation. Never done that in Python, because the situations where that's necessary are (a) rare, and (b) generally suitable for a regex anyway. Does anyone have a really complex parsing job that absolutely cannot be done with a regex, and benefits from reversal? ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/