Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed6.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'ascii': 0.07; 'objects,': 0.07; 'used.': 0.07; 'utf-8': 0.07; 'missed': 0.09; 'subject:How': 0.09; 'compact': 0.09; 'derived': 0.09; 'exist.': 0.09; 'imply': 0.09; 'internally': 0.09; 'non-ascii': 0.09; 'oh,': 0.09; 'received:mail-lpp01m010-f46.google.com': 0.09; 'structure,': 0.09; 'subject:()': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'stored': 0.10; 'aug': 0.13; 'describing': 0.16; 'subject:unicode': 0.16; 'subject:variable': 0.16; 'wording': 0.16; 'string': 0.17; 'wrote:': 0.17; 'bit': 0.21; 'header:In- Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; '"the': 0.29; 'received:209.85.215.46': 0.30; 'structure': 0.32; 'says': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'data,': 0.35; 'exist': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'skip:p 20': 0.36; 'uses': 0.37; 'rather': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'fields,': 0.84; 'subject:value': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=B3ghqQqWO1rdi4OAp8TYvA0pW0MZN7RckItz3Bltgq0=; b=gc9ej0MdQpk9p/7uLiA0s1BJOYmhGZsRkTc+GWzf9RpSg910oZG36THbFNlfs5fEyh v6wk5RG8/xqOD9sOZbeR8/xDJFYaQcnNGoO40OPBcNqGjC0Qcg1LKH4DR9o7+/LW7hdK lJd4yLMFeOZxjJaG+X1v40VQT5DzxY/ud0pG8bHtdazN019aDtVsVpnEXN9cb2BBAW6/ Bd0vempkM/Q39mdgMSz/XvpC7DStVtzgKPYOUYBVFNjl/Q8KdjYCSoNUQchcaMlHAmC4 RyaTkKeXSLsQv6UeGkT/C+iln1gmProsHD+qHFAnm13m1TIb90kDgLcqPOepg9GVjKrz A3fg== MIME-Version: 1.0 In-Reply-To: References: <308df2af-abe7-4043-b199-0a39f440e0ab@googlegroups.com> <502f8a2a$0$29978$c3e8da3$5496439d@news.astraweb.com> <503088b7$0$29978$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Sun, 19 Aug 2012 12:46:27 -0600 Subject: Re: How do I display unicode value stored in a string variable using ord() To: Python Content-Type: text/plain; charset=ISO-8859-1 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: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345402019 news.xs4all.nl 6928 [2001:888:2000:d::a6]:55555 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27420 On Sun, Aug 19, 2012 at 11:50 AM, Ian Kelly wrote: > Note that this only describes the structure of "compact" string > objects, which I have to admit I do not fully understand from the PEP. > The wording suggests that it only uses the PyASCIIObject structure, > not the derived structures. It then says that for compact ASCII > strings "the UTF-8 data, the UTF-8 length and the wstr length are the > same as the length of the ASCII data." But these fields are part of > the PyCompactUnicodeObject structure, not the base PyASCIIObject > structure, so they would not exist if only PyASCIIObject were used. > It would also imply that compact non-ASCII strings are stored > internally as UTF-8, which would be surprising. Oh, now I get it. I had missed the part where it says "character data immediately follow the base structure". And the bit about the "UTF-8 data, the UTF-8 length and the wstr length" are not describing the contents of those fields, but rather where the data can be alternatively found since the fields don't exist.