Path: csiph.com!usenet.pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!bcyclone02.am1.xlned.com!bcyclone02.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1a.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; 'mrab': 0.05; 'subject:Python': 0.06; '"""': 0.07; 'encoded': 0.07; 'character,': 0.09; 'convention,': 0.09; 'happen.': 0.09; 'parsed': 0.09; 'url:unicode': 0.09; 'ah,': 0.16; 'characters:': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'pairs,': 0.16; 'received:192.168.1.4': 0.16; 'subject:Unicode': 0.16; 'surrogate': 0.16; 'unlikely': 0.16; ':-)': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'seems': 0.21; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'unicode': 0.24; 'looks': 0.24; 'second': 0.26; 'header:In-Reply- To:1': 0.27; 'character': 0.29; "i'm": 0.30; 'subject: (': 0.35; 'but': 0.35; 'in:': 0.36; 'sequence': 0.36; 'url:org': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'according': 0.40; 'skip:u 10': 0.60; 'read': 0.60; 'is.': 0.60; 'url:3': 0.61; 'further': 0.61; 'first': 0.61; 'url:0': 0.67; 'between': 0.67; 'mistake': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=DZWZq5dW c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=SY9aFQKHIdAA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=te1EGT4yAAAA:8 a=W4HtEw26bIWH5o9TPGsA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett@:2500 Date: Sun, 03 May 2015 18:09:20 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Unicode surrogate pairs (Python 3.4) References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1430672962 news.xs4all.nl 2845 [2001:888:2000:d::a6]:34778 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4241 X-Received-Body-CRC: 621919125 Xref: csiph.com comp.lang.python:89885 On 2015-05-03 17:26, Jon Ribbens wrote: > On 2015-05-03, MRAB wrote: >> On 2015-05-03 16:32, Jon Ribbens wrote: >>> That would, unfortunately, be "tell the Unicode Consortium to format >>> their documents differently", which seems unlikely to happen. I'm >>> trying to read in: http://www.unicode.org/Public/idna/6.3.0/IdnaTest.txt >>> >> That document looks like it's encoded in UTF-8. > > It is. But it also, for reasons best known to the Unicode Consortium, > contains strings of the form \uXXXX which need to be parsed into the > appropriate character, and some of *those* are then surrogate pairs, > which need to be further converted. > Ah, so it's r"\udb40\udd9d". :-) There's also a mistake in this bit: """ # Note that according to the \uXXXX escaping convention, a supplemental character (> 0x10FFFF) is represented # by a sequence of two surrogate characters: the first between D800 and DBFF, and the second between DC00 and DFFF. """