Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'output': 0.05; 'utf-8': 0.07; 'string': 0.09; 'tcl/tk': 0.09; 'subject:question': 0.10; 'python': 0.11; '(say': 0.16; 'displaying': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'magic': 0.16; 'sees': 0.16; 'subject:unicode': 0.16; 'wow,': 0.16; 'wrote:': 0.18; "python's": 0.19; 'header :User-Agent:1': 0.23; 'char': 0.24; 'copied': 0.24; 'unicode': 0.24; 'order.': 0.26; 'right.': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'appear': 0.29; 'characters': 0.30; 'mode': 0.30; '>>>>': 0.31; 'prints': 0.31; 'text': 0.33; 'there,': 0.34; 'but': 0.35; 'done': 0.36; 'starting': 0.37; 'message- id:@gmail.com': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'letters': 0.60; 'matter': 0.61; 'simply': 0.61; 'first': 0.61; 'complete': 0.62; 'here': 0.66; 'reverse': 0.68; 'end.': 0.84 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Wed, 28 Jan 2015 20:01:08 -0700 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: unicode question References: <1422483422.18222.BPMail_high_carrier@web163802.mail.gq1.yahoo.com> In-Reply-To: <1422483422.18222.BPMail_high_carrier@web163802.mail.gq1.yahoo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422500483 news.xs4all.nl 2838 [2001:888:2000:d::a6]:41268 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84799 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.