Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52376

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joshua.landau.ws@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.024
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.06; 'utf-8': 0.07; 'string': 0.09; 'arguments': 0.09; 'bytes.': 0.09; 'imply': 0.09; 'raises': 0.09; 'api': 0.11; 'cc:addr:python-list': 0.11; "wouldn't": 0.14; 'anyhow,': 0.16; 'learnt': 0.16; 'link,': 0.16; 'parts,': 0.16; 'subject:Could': 0.16; 'subject:Unicode': 0.16; 'unicode.': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'obviously': 0.18; 'pointed': 0.19; 'seems': 0.21; '>>>': 0.22; 'aug': 0.22; 'cc:addr:python.org': 0.22; 'url:dev': 0.24; "haven't": 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'references': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'characters': 0.30; 'message-id:@mail.gmail.com': 0.30; 'though.': 0.31; 'interface': 0.32; 'subject:the': 0.34; 'could': 0.34; 'received:google.com': 0.35; 'subject:List': 0.36; 'subject:?': 0.36; 'list': 0.37; 'issue': 0.38; 'fact': 0.38; 'does': 0.39; 'url:2012': 0.39; 'either': 0.39; 'how': 0.40; 'even': 0.60; 'skip:u 10': 0.60; 'read': 0.60; 'august': 0.61; 'eye': 0.61; 'length': 0.61; 'mentioned': 0.61; 'matter': 0.61; "you're": 0.61; 'therefore,': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; 'between': 0.67; 'six': 0.68; 'combining': 0.68; 'article': 0.77; 'url:wordpress': 0.78; 'counts': 0.83; 'subject:this': 0.83; 'characters,': 0.84; 'subject:you': 0.87; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=uLNqpezp/Und73sDxux8wFUXITTQVJRsN39VkfVILPE=; b=jwQRPyRuMQsWb4+/sh6qLe6Q380c7h1jvqDwnGDi9+cn9M/aSBYUGOkhzZEiD2vlME KocCGcYuncBOhIPuyAxffVA1bIQ339Qe/Cl6HlwSmm+32dSGt+txT7rNAd3JSWQudAne VpHvIAdZXse7Q+9CDWQ5tZsdaWbJTDgld0g70zbGDu0aGwHX9SDvVoxlNWxlQd/Gx7Mz e+LrmX4//M6/7qD/S+lcerghdbrHV/3cP/Zszvf+m7ZXMy0ZgYKTsBzOLZZNuWysBemW jNjwCMPSpGHXQ9ZwtwOLCRClw+fXxYxQToNm0xAwsd9onGi6o0DWLqE8dQHxruxjbzU2 juPg==
X-Received by 10.152.19.70 with SMTP id c6mr9437567lae.25.1376214923938; Sun, 11 Aug 2013 02:55:23 -0700 (PDT)
MIME-Version 1.0
Sender joshua.landau.ws@gmail.com
In-Reply-To <CAPTjJmp1PFP8d8F1KVfaatDA56NszJK3SqO_sGORhhOEeGaJ+w@mail.gmail.com>
References <CAN1F8qXgBwTGSkbP3N1uJZPJw1CY=4O4ptQurV-2=Gmm4UiYbw@mail.gmail.com> <CAPTjJmp1PFP8d8F1KVfaatDA56NszJK3SqO_sGORhhOEeGaJ+w@mail.gmail.com>
From Joshua Landau <joshua@landau.ws>
Date Sun, 11 Aug 2013 10:54:43 +0100
X-Google-Sender-Auth ITSRYSNmGqPYRuEyWBM99QPbFtw
Subject Re: Could you verify this, Oh Great Unicode Experts of the Python-List?
To Chris Angelico <rosuav@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.475.1376214926.1251.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1376214926 news.xs4all.nl 15926 [2001:888:2000:d::a6]:49744
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:52376

Show key headers only | View raw


On 11 August 2013 07:24, Chris Angelico <rosuav@gmail.com> wrote:
> On Sun, Aug 11, 2013 at 7:17 AM, Joshua Landau <joshua@landau.ws> wrote:
>> Given tweet = b"caf\x65\xCC\x81".decode():
>>
>>     >>> tweet
>>     'café'
>>
>> But:
>>
>>     >>> len(tweet)
>>     5
>
> You're now looking at the difference between glyphs and combining
> characters. Twitter counts combining characters, so when you build one
> "thing" out of lots of separately-typed parts, it does count as more
> characters.

@https://dev.twitter.com/docs/counting-characters#Definition_of_a_Character
> The "café" issue mentioned above raises the question of how you count
> the characters in the Tweet string "café". To the human eye the length is
> clearly four characters. Depending on how the data is represented this
> could be either five or six UTF-8 bytes. Twitter does not want to penalize
> a user for the fact we use UTF-8 or for the fact that the API client in
> question used the longer representation. Therefore, Twitter does count
> "café" as four characters no matter which representation is sent.

Which would imply that twitter doesn't count combining characters,
even though the web interface seems to.

> Read this article for some arguments on the subject, including a
> number of references to Twitter itself:
>
> http://unspecified.wordpress.com/2012/04/19/the-importance-of-language-level-abstract-unicode-strings/

I read that *last* time you pointed it out :P. It's a good link, though.

--
Anyhow, it's good to know I haven't been obviously stupid with my
understanding of Unicode. I learnt it all from this list anyway;
wouldn't want to disappoint!

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Could you verify this, Oh Great Unicode Experts of the Python-List? Joshua Landau <joshua@landau.ws> - 2013-08-11 10:54 +0100

csiph-web