Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 19 Aug 2012 05:13:17 -0500 Date: Sun, 19 Aug 2012 11:13:11 +0100 From: lipska the kat User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120410 Thunderbird/11.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.python Subject: Re: How do I display unicode value stored in a string variable using ord() References: <308df2af-abe7-4043-b199-0a39f440e0ab@googlegroups.com> <502f8a2a$0$29978$c3e8da3$5496439d@news.astraweb.com> <7xehn4vyya.fsf@ruckus.brouhaha.com> <5030832d$0$29978$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <5030832d$0$29978$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Lines: 58 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-8KnuxHa0vGW/UM2NfSe3TTB8I8okscaMjscW4D3tmWKzkh7xgGwRDFz7xQJ58rlhIs0/ngobbSa14re!wJGf7ugg1tPdHwjjr+R6nvWXiXvAqW2N8Zonyk3tpATcQskhWv6uT28WJ61Xsovsl6jZ5e5wAYc= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2766 Xref: csiph.com comp.lang.python:27371 On 19/08/12 07:09, Steven D'Aprano wrote: > This is a long post. If you don't feel like reading an essay, skip to the > very bottom and read my last few paragraphs, starting with "To recap". Thank you for this excellent post, it has certainly cleared up a few things for me [snip] incidentally > But in UTF-16, ... [snip] > py> s = chr(0xFFFF + 1) > py> a, b = s > py> a > '\ud800' > py> b > '\udc00' in IDLE Python 3.2.3 (default, May 3 2012, 15:51:42) [GCC 4.6.3] on linux2 Type "copyright", "credits" or "license()" for more information. ==== No Subprocess ==== >>> s = chr(0xFFFF + 1) >>> a, b = s Traceback (most recent call last): File "", line 1, in a, b = s ValueError: need more than 1 value to unpack At a terminal prompt [lipska@ubuntu ~]$ python3.2 Python 3.2.3 (default, Jul 17 2012, 14:23:10) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> s = chr(0xFFFF + 1) >>> a, b = s >>> a '\ud800' >>> b '\udc00' >>> The date stamp is different but the Python version is the same No idea why this is happening, I just thought it was interesting lipska -- Lipska the Kat©: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun