Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.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; 'explicitly': 0.04; 'cpython': 0.05; 'source.': 0.05; 'familiarity': 0.07; 'puts': 0.07; 'strings.': 0.07; 'python': 0.09; 'does,': 0.09; 'literal': 0.09; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sep': 0.09; 'subject:string': 0.09; 'terry': 0.09; 'decoding': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:unicode': 0.16; 'surrogate': 0.16; 'wrote:': 0.17; 'widely': 0.17; 'jan': 0.18; '>>>': 0.18; 'requests': 0.18; 'equivalent': 0.20; '3.2': 0.22; 'assumes': 0.22; "python's": 0.23; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'strings,': 0.29; 'yes.': 0.29; 'points': 0.29; 'code': 0.31; 'builds': 0.33; 'to:addr:python- list': 0.33; 'pm,': 0.35; 'received:org': 0.36; 'enough': 0.36; 'uses': 0.37; 'subject:: ': 0.38; 'fact': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'subject:, ': 0.61; 'wide': 0.62; 'subject:...': 0.63; 'believe': 0.69; 'consequences': 0.71; 'policy.': 0.71; 'basically,': 0.84; 'received:fios.verizon.net': 0.84; 'spread.': 0.84; 'subject:, ...': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Flexible string representation, unicode, typography, ... Date: Sun, 02 Sep 2012 22:33:55 -0400 References: <503a0d51$0$6574$c3e8da3$5496439d@news.astraweb.com> <503a8361$0$6574$c3e8da3$5496439d@news.astraweb.com> <2e92da71-fbd2-467f-9088-1c79fa7bcf69@googlegroups.com> <62566024-df1d-4948-a27a-45c7820ddc6c@googlegroups.com> <503f0e45$0$9416$c3e8da3$76491128@news.astraweb.com> <50440de2$0$29967$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120824 Thunderbird/15.0 In-Reply-To: <50440de2$0$29967$c3e8da3$5496439d@news.astraweb.com> 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346639651 news.xs4all.nl 6939 [2001:888:2000:d::a6]:42793 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28334 On 9/2/2012 9:54 PM, Steven D'Aprano wrote: > On Sun, 02 Sep 2012 23:38:49 +0300, Serhiy Storchaka wrote: > >> On 30.08.12 09:55, Steven D'Aprano wrote: >>> And Python's solution uses those: UCS-2, UCS-4, and UTF-8. >> >> I see that this misconception widely spread. > > I am not familiar enough with the C implementation to tell what Python > 3.3 actually does, and the PEP assumes a fair amount of familiarity with > the CPython source. So I welcome corrections. > > >> In fact Python 3.3 uses four kinds of ready strings. >> >> * ASCII. All codes <= U+007F. >> * UCS1. All codes <= U+00FF, at least one code > U+007F. >> * UCS2. All codes <= U+FFFF, at least one code > U+00FF. >> * UCS4. All codes <= U+0010FFFF, at least one code > U+FFFF. > > Where UCS1 is equivalent to Latin-1, correct? > > UCS2 is what Python 3.2 narrow builds uses for all strings, including > codes > U+FFFF using surrogate pairs. > > UCS4 is what Python 3.2 wide builds uses for all strings. > > This means that Python 3.3 will no longer have surrogate pairs. Basically, yes. I believe CPython will only use surrogate code points if one requests errors=surrogate-escape on decoding or explicitly puts them in a literal (\unnnn or \Ummmmmmmm). The consequences fall under the 'consenting adults' policy. -- Terry Jan Reedy