unicode question

Michael Torrie torriem at gmail.com
Wed Jan 28 22:01:08 EST 2015


On 01/28/2015 03:17 PM, Albert-Jan Roskam wrote:
>> I do not know how complete the support is, but this is copied from 3.4.2, which uses tcl/tk 8.6.
>>>> t = "الحركات"
>>>> for c in t: print(c)  # Prints rightmost char above first
>> ا
>> ل
>> ح
>> ر
>> ك
>> ا
>> ت
> 
> Wow, I never knew this was so clever. Is that with or without an RTL marker?

I don't think this has anything to do with Python. Python is simply
spitting out unicode characters as it sees them, starting at string
position 0 and working to the end.  The magic is done by whatever is
displaying the utf-8 output from Python.  If I copy this text to the
clipboard,

t = "hi there, الحركات!"

and paste it in my terminal (say to Python's shell), which is not BIDI
aware, I get the Arabic letters in reverse order. I tried to paste it
here but no matter what I do thunderbird goes into BIDI mode and makes
them appear right.




More information about the Python-list mailing list