Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed3.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.029 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.01; 'mrab': 0.05; '(python': 0.07; 'skip:u 30': 0.07; 'width': 0.09; '3):': 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; 'neutral': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'width.': 0.16; ':-)': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'character': 0.29; 'characters': 0.30; 'question:': 0.31; 'are:': 0.33; 'received:84': 0.35; 'possible': 0.36; 'depends': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'dave': 0.60; 'july': 0.63; 'header:Reply-To:1': 0.67; 'reply- to:no real name:2**0': 0.71; 'capital': 0.73; 'ambiguous': 0.84; 'reply-to:addr:python.org': 0.84; 'angel': 0.91; 'serious': 0.97; '2013': 0.98 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=RZapVTdv c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=K2DDQYBT4xIA:10 a=u80fQ1bUu3EA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=v3zk7EHNYBYA:10 a=MPa6gNbeUGZ5SbYScgoA:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett:2500 Date: Tue, 09 Jul 2013 00:32:00 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: python-list@python.org Subject: Re: hex dump w/ or w/out utf-8 chars References: <7b6fc645-8bf3-4681-821c-38fb1fa1d191@googlegroups.com> <51DB313C.4040701@mrabarnett.plus.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1373326299 news.xs4all.nl 15939 [2001:888:2000:d::a6]:55449 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:50184 On 08/07/2013 23:02, Joshua Landau wrote: > On 8 July 2013 22:38, MRAB wrote: >> On 08/07/2013 21:56, Dave Angel wrote: >>> Characters do not have a width. >> >> [snip] >> >> It depends what you mean by "width"! :-) >> >> Try this (Python 3): >> >>>>> print("A\N{FULLWIDTH LATIN CAPITAL LETTER A}") >> AA > > Serious question: How would one find the width of a character by that > definition? > >>> import unicodedata >>> unicodedata.east_asian_width("A") 'Na' >>> unicodedata.east_asian_width("\N{FULLWIDTH LATIN CAPITAL LETTER A}") 'F' The possible widths are: N = Neutral A = Ambiguous H = Halfwidth W = Wide F = Fullwidth Na = Narrow All you then need to do is find out what those actually mean...