Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'output': 0.04; '(python': 0.05; 'memory.': 0.05; 'python3': 0.05; 'say,': 0.05; 'ascii': 0.07; 'utf-8': 0.07; 'missed': 0.09; 'scripts': 0.09; 'subject:How': 0.09; 'python': 0.09; 'coding,': 0.09; 'encode': 0.09; 'pep': 0.09; 'subject:()': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'aug': 0.13; 'cases': 0.15; 'encoding': 0.15; '(eg.': 0.16; 'circumvent': 0.16; 'codec': 0.16; 'cp1252': 0.16; 'encodings': 0.16; 'for,': 0.16; 'jerry': 0.16; 'ordinal': 0.16; 'subject:unicode': 0.16; 'subject:variable': 0.16; 'wrote:': 0.17; 'unicode': 0.17; 'obviously': 0.18; 'sort': 0.21; '"",': 0.22; 'sorry,': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'wrote': 0.26; '(most': 0.27; 'coding': 0.27; 'older': 0.27; 'skip:( 20': 0.28; 'all.': 0.28; '>>>>': 0.29; 'served': 0.29; 'character': 0.29; 'definition': 0.29; '8bit%:5': 0.29; 'source': 0.29; 'this.': 0.29; 'fri,': 0.30; 'code': 0.31; 'file': 0.32; "skip:' 20": 0.32; 'could': 0.32; 'european': 0.33; 'legacy': 0.33; 'traceback': 0.33; 'problem': 0.33; 'point.': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'text': 0.34; 'exist': 0.35; 'moved': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'apple': 0.36; 'characters': 0.36; 'should': 0.36; 'display': 0.36; 'keeps': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'comment': 0.38; 'some': 0.38; 'nothing': 0.38; 'called': 0.39; 'your': 0.60; 'easy': 0.60; 'from:no real name:2**0': 0.60; 'skip:u 10': 0.60; 'real': 0.61; 'french': 0.64; 'charset:windows-1252': 0.65; 'user,': 0.69; '21st': 0.75; '100%': 0.76; 'products,': 0.78; 'century,': 0.84; 'subject:value': 0.84; 'hill': 0.96 Newsgroups: comp.lang.python Date: Fri, 17 Aug 2012 11:45:02 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=83.78.180.128; posting-account=ung4FAoAAAC46zhHJ0Nsnuox7M5gDvs_ References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 83.78.180.128 MIME-Version: 1.0 Subject: Re: How do I display unicode value stored in a string variable using ord() From: wxjmfauth@gmail.com To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 107 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345229106 news.xs4all.nl 6910 [2001:888:2000:d::a6]:53123 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27256 Le vendredi 17 ao=FBt 2012 20:21:34 UTC+2, Jerry Hill a =E9crit=A0: > On Fri, Aug 17, 2012 at 1:49 PM, wrote: >=20 > > The character '=85', Unicode name 'HORIZONTAL ELLIPSIS', >=20 > > is one of these characters existing in the cp1252, mac-roman >=20 > > coding schemes and not in iso-8859-1 (latin-1) and obviously >=20 > > not in ascii. It causes Py3.3 to work a few 100% slower >=20 > > than Py<3.3 versions due to the flexible string representation >=20 > > (ascii/latin-1/ucs-2/ucs-4) (I found cases up to 1000%). >=20 > > >=20 > >>>> '=85'.encode('cp1252') >=20 > > b'\x85' >=20 > >>>> '=85'.encode('mac-roman') >=20 > > b'\xc9' >=20 > >>>> '=85'.encode('iso-8859-1') # latin-1 >=20 > > Traceback (most recent call last): >=20 > > File "", line 1, in >=20 > > UnicodeEncodeError: 'latin-1' codec can't encode character '\u2026' >=20 > > in position 0: ordinal not in range(256) >=20 > > >=20 > > If one could neglect this (typographically important) glyph, what >=20 > > to say about the characters of the European scripts (languages) >=20 > > present in cp1252 or in mac-roman but not in latin-1 (eg. the >=20 > > French script/language)? >=20 >=20 >=20 > So... python should change the longstanding definition of the latin-1 >=20 > character set? This isn't some sort of python limitation, it's just >=20 > the reality of legacy encodings that actually exist in the real world. >=20 >=20 >=20 >=20 >=20 > > Very nice. Python 2 was built for ascii user, now Python 3 is >=20 > > *optimized* for, let say, ascii user! >=20 > > >=20 > > The future is bright for Python. French users are better >=20 > > served with Apple or MS products, simply because these >=20 > > corporates know you can not write French with iso-8859-1. >=20 > > >=20 > > PS When "TeX" moved from the ascii encoding to iso-8859-1 >=20 > > and the so called Cork encoding, "they" know this and provided >=20 > > all the complementary packages to circumvent this. It was >=20 > > in 199? (Python was not even born). >=20 > > >=20 > > Ditto for the foundries (Adobe, Linotype, ...) >=20 >=20 >=20 >=20 >=20 > I don't understand what any of this has to do with Python. Just >=20 > output your text in UTF-8 like any civilized person in the 21st >=20 > century, and none of that is a problem at all. Python make that easy. >=20 > It also makes it easy to interoperate with older encodings if you >=20 > have to. >=20 Sorry, you missed the point. My comment had nothing to do with the code source coding, the coding of a Python "string" in the code source or with the display of a Python3 . I wrote about the *internal* Python "coding", the way Python keeps "strings" in memory. See PEP 393. jmf