Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!217.188.199.168.MISMATCH!takemy.news.telefonica.de!telefonica.de!newsfeed.xs4all.nl!newsfeed1.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'character,': 0.07; 'formatting': 0.07; 'lines.': 0.07; 'reason,': 0.07; 'width': 0.07; '"default': 0.09; 'logic': 0.09; 'pixels': 0.09; 'url:unicode': 0.09; 'yeah,': 0.09; 'cc:addr:python-list': 0.10; 'instead.': 0.15; 'represents': 0.15; 'thu,': 0.15; 'character:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ideally,': 0.16; 'url:faq': 0.16; 'width,': 0.16; 'wrote:': 0.16; 'skip:u 30': 0.18; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'space.': 0.22; 'visible': 0.22; '2015': 0.23; 'player': 0.23; "i've": 0.24; 'header:In-Reply- To:1': 0.24; 'points': 0.27; 'message-id:@mail.gmail.com': 0.28; 'looks': 0.29; 'bad.': 0.29; 'character.': 0.29; 'fighting': 0.29; 'character': 0.29; 'no,': 0.29; 'skip:u 20': 0.30; 'supposed': 0.31; 'code': 0.31; 'possibly': 0.32; "d'aprano": 0.33; 'impression': 0.33; 'point,': 0.33; 'steven': 0.33; 'surely': 0.33; 'received:google.com': 0.34; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'totally': 0.36; 'two': 0.37; 'should': 0.37; 'display': 0.37; 'subject:: ': 0.37; 'space': 0.38; 'pm,': 0.39; 'takes': 0.39; 'well.': 0.40; 'mark': 0.40; 'why': 0.40; 'some': 0.40; 'learn': 0.60; 'default': 0.61; 'skip:u 10': 0.62; 'show': 0.62; 'day.': 0.63; 'within': 0.64; 'due': 0.65; 'series': 0.65; 'box.': 0.66; 'policy,': 0.66; 'media': 0.67; 'letters': 0.67; 'believe': 0.67; 'chrisa': 0.84; 'fat': 0.84; 'sometimes.': 0.84; 'to:none': 0.90; 'notable': 0.91; 'url:youtu': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=+OIwG2f75VR9e5D7K4hVomY07yxqC6mXmJj7g52dbgM=; b=xN6PJs3TJfcwxoxj8d010Nqwxe6dXtIhIfhKfN1svqWAqC8pH7R/tSD9N1dlzgfha3 D/PoH/h1N25rbAtyOlTJaXQ8+P9lHOq6cONC/vkPG84HLdEq985BKtOthDfhd1KAEqzn N8OR4pzWACjHqNcQDXUWtwCvrK5v/AMWiucrQdS0KjFadeXSga+tj0ApE7DQdgRMfIVd sVCxYkvkHc7QNNicX1TkqbFd33Jbi4BbngLAekBWu2iqDwIiIulnac+VPYUaFpQE+33y KbnNE0hMxSmopfVnQg/TfoFgHl/gHsjsLg6IX/Nm7jXjr61RXYscspUQZTKAkV90q+mJ 12VA== MIME-Version: 1.0 X-Received: by 10.50.143.104 with SMTP id sd8mr31554855igb.14.1433991935669; Wed, 10 Jun 2015 20:05:35 -0700 (PDT) In-Reply-To: <5578f1be$0$12979$c3e8da3$5496439d@news.astraweb.com> References: <20150610082812.2ce887c3@bigbox.christie.dr> <55786fd5$0$13003$c3e8da3$5496439d@news.astraweb.com> <5578f1be$0$12979$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 11 Jun 2015 13:05:35 +1000 Subject: Re: Python NBSP DWIM From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1433991937 news.xs4all.nl 2956 [2001:888:2000:d::a6]:51869 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:92443 On Thu, Jun 11, 2015 at 12:26 PM, Steven D'Aprano wrote: > No, despite the name, that is not a space character, it is a formatting > character. Due to Unicode's stability policy, the name is stuck forever, > but it should not be treated as a space character: > > py> unicodedata.category(' ') > 'Zs' > py> unicodedata.category('\u00A0') # NBSP > 'Zs' > py> unicodedata.category('\uFEFF') # ZWNBSP > 'Cf' > > > Ideally, outside of the BOM, you should never come across a ZWNBSP. You > should use U+2060 WORD JOINER instead. But if you do come across one > outside of the BOM, it should be treated as a legitimate non-space > character: > > http://www.unicode.org/faq/utf_bom.html#bom6 > > Although ZWNBSP is a "default ignorable" code point, I believe that the font > is well within its rights to show it with a visible glyph: > > "Fonts can contain glyphs intended for visible display of > default ignorable code points that would otherwise be > rendered invisibly when not supported." > > http://www.unicode.org/faq/unsup_char.html Huh. Okay, my bad. I was under the impression that it was supposed to take up no width, as the name implies, but stability trumps logic sometimes. Learn something new every day. >> notable because it's also used as >> the byte-order mark (as its counterpart, U+FFFE, is unallocated). I've >> been fighting with VLC Media Player over the font it uses for subtitles; >> for some bizarre reason, that font represents U+FEFF not with zero pixels >> of emptiness, but with a box containing the letters "ZWN" "BSP" on two >> lines. Yeah, because that totally takes up zero width and looks like blank >> space. > > Why do the subtitles contain ZWNBSP in the first place? Surely they're not > English subtitles? No, they're not :) The character comes up in the Cantonese and Japanese subs for Once Upon A December. http://youtu.be/CEpcUeWP0bg http://youtu.be/WFZAaHrHens Possibly some others in the series as well. It may well be a fault in the subtitles, but most programs I've seen don't show U+FEFF as a big fat box. ChrisA