Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'broken': 0.04; 'subject:Python': 0.06; 'subject: -- ': 0.07; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; '~ethan~': 0.09; 'situation.': 0.16; 'subject:Unicode': 0.16; 'subject:handling': 0.16; 'wrote:': 0.18; 'library': 0.18; 'skip:p 40': 0.19; 'header :User-Agent:1': 0.23; 'example.': 0.24; 'stephen': 0.24; 'unicode': 0.24; '(or': 0.24; 'gets': 0.27; 'header:In-Reply- To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'room': 0.29; 'characters': 0.30; 'dec': 0.30; 'code': 0.31; '>>>>': 0.31; 'breaking': 0.31; 'knowledge': 0.35; "can't": 0.35; 'but': 0.35; 'there': 0.35; 'handle': 0.38; 'whatever': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:173': 0.61; 'batchelder': 0.84; 'is)': 0.84; '2013': 0.98 Date: Mon, 02 Dec 2013 13:27:08 -0800 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Python Unicode handling wins again -- mostly References: <529934dc$0$29993$c3e8da3$5496439d@news.astraweb.com> <529CEFB1.2030007@stoneleaf.us> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:34993 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 5 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386020836 news.xs4all.nl 16004 [2001:888:2000:d::a6]:44457 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:60891 On 12/02/2013 01:23 PM, Chris Angelico wrote: > On Tue, Dec 3, 2013 at 8:14 AM, Ned Batchelder wrote: >> This is where my knowledge about Unicode gets fuzzy. Isn't it the case that >> some grapheme clusters (or whatever the right word is) can't be normalized >> down to a single code point? Characters can accept many accents, for >> example. > > You can't normalize everything down to a single code point, but you > can normalize the other way by breaking out everything that can be > broken out. > >>>> print(ascii(unicodedata.normalize("NFKC", "ä"))) > '\xe4' >>>> print(ascii(unicodedata.normalize("NFKD", "ä"))) > 'a\u0308' Well, Stephen was right then! There's room for a library to handle this situation. Or is there one already? -- ~Ethan~