Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed1a.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; 'programmer': 0.03; 'subject:text': 0.05; 'received:internal': 0.09; 'subject:question': 0.10; 'assume': 0.14; 'random': 0.14; '(say': 0.16; 'access)': 0.16; 'backspace': 0.16; 'columns': 0.16; 'for,': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'pressing': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:messagingengine.com': 0.16; 'wrote:': 0.18; 'rules': 0.22; 'proxy': 0.24; "haven't": 0.24; '(for': 0.26; 'header:In- Reply-To:1': 0.27; 'characters': 0.30; 'code': 0.31; 'languages': 0.32; 'fri,': 0.33; 'received:66': 0.35; 'common': 0.35; 'example,': 0.37; 'received:10': 0.37; 'e.g.': 0.38; 'to:addr :python-list': 0.38; 'support,': 0.39; 'to:addr:python.org': 0.39; 'units': 0.60; 'most': 0.60; 'from:no real name:2**0': 0.61; 'length': 0.61; 'times': 0.62; "you've": 0.63; 'header:Message- Id:1': 0.63; 'mar': 0.68; 'combining': 0.68; 'safe': 0.72 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:subject:date:in-reply-to :references; s=mesmtp; bh=pOSf3Yu+XrL74i0+dJkBae0LMH0=; b=kZ7nG3 jepf8/9+RE+QayP8IUPfWtEfzy7E88yPzl4fdNBZYIsH2hln1zQI4vGY093Wb3HU 8vF9qSfmbTk80/qJfCT7uZGHf6dPZZ7enupPYKaEn7Iv5RREx4OtMuLn7hvGUArJ CZB2v5dTtqNwqdTFo8Pw7dc/lyr8hLxYnk1U4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:subject :date:in-reply-to:references; s=smtpout; bh=pOSf3Yu+XrL74i0+dJkB ae0LMH0=; b=IGEnzBVDe8D7u6VUDf+6C5jk6MBPi76hCk+Mity//FSz8gpFk/C2 wUjjVF6KdLLV0xRZp7EV3ExbgxhhScbV5lmL3SIwMAlj6ji1MWY3EyxqiOOYx90C aChubNpAaDlwGZO7fi9lSqNqVOIEgHTJREC4K0RugMOP7nDIzyxF0tw= X-Sasl-Enc: M62+5Mui8HJixAwkmMDLQGouubUIXuRoqC5gntK1W92O 1425648780 From: random832@fastmail.us To: python-list@python.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-07699171 Subject: Re: Newbie question about text encoding Date: Fri, 06 Mar 2015 08:33:00 -0500 In-Reply-To: References: <201502241524.t1OFO09k022270@fido.openend.se> <201502241620.t1OGKf4n002146@fido.openend.se> <54ECB134.5090304@davea.name> <201502241945.t1OJjshO013092@fido.openend.se> <201502241957.t1OJvrJS015604@fido.openend.se> <9169f3b1-2ac7-42a3-8033-584f84b88a1f@googlegroups.com> <7a75a23c-4678-4d7a-a2ec-9e8fff4c07f8@googlegroups.com> <132d5ce6-f672-4eec-99f9-1cc9e88b94f3@googlegroups.com> <619e4cb5-1c4c-449b-a5d7-951101b32b45@googlegroups.com> <54f862ca$0$13014$c3e8da3$5496439d@news.astraweb.com> <01dd9b83-db3e-4e7d-9022-dc6af75eb570@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1425648784 news.xs4all.nl 2932 [2001:888:2000:d::a6]:54005 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87020 On Fri, Mar 6, 2015, at 04:06, Rustom Mody wrote: > Also: > Can a programmer who is away from UTF-16 in one part of the system (say > by using python3) > assume he is safe all over? The most common failure of UTF-16 support, supposedly, is in programs misusing the number of code units (for length or random access) as a proxy for the number of characters. However, when do you _really_ want the number of characters? You may want to use it for, for example, the number of columns in a 'monospace' font, which you've already screwed up because you haven't accounted for double-wide characters or combining marks. Or you may want the position that pressing an arrow key or backspace or forward-delete a number of times will reach, which has its own rules in e.g. Indic languages (and also fails on Latin with combining marks).