Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:skip:s 10': 0.05; 'terry': 0.09; 'cc:addr:python-list': 0.10; ':-)': 0.13; "'o',": 0.16; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'reedy': 0.16; 'stdlib.': 0.16; 'stripped': 0.16; 'us-ascii': 0.16; 'wrote:': 0.17; 'tim': 0.18; '(or': 0.18; 'sort': 0.21; "i'd": 0.22; 'cc:2**0': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'chase': 0.29; 'could': 0.32; 'text': 0.34; 'doing': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'something': 0.35; 'but': 0.36; 'characters': 0.36; 'subject:: ': 0.38; 'mean': 0.38; 'subject:-': 0.40; 'information': 0.63; 'dict.': 0.84; 'received:50.22': 0.84; 'wanted,': 0.84 Date: Thu, 13 Sep 2012 18:54:22 -0500 From: Tim Chase User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 MIME-Version: 1.0 To: Terry Reedy Subject: Re: Least-lossy string.encode to us-ascii? References: <50524F6F.6070604@tim.thechases.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Source: X-Source-Args: X-Source-Dir: Cc: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347580392 news.xs4all.nl 6848 [2001:888:2000:d::a6]:60729 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29093 On 09/13/12 18:36, Terry Reedy wrote: > On 9/13/2012 5:26 PM, Tim Chase wrote: >> I've got a bunch of text in Portuguese and to transmit them, need to >> have them in us-ascii (7-bit). I'd like to keep as much information >> as possible,just stripping accents, cedillas, tildes, etc. > > 'keep as much information as possible' would mean an effectively > lossless transliteration, which you could do with a dict. > {: 'o', : 'c,' (or pick something that would > never occur in normal text of the sort you are transmitting), ...} Vlastimil's solution kept the characters but stripped them of their accents/tildes/cedillas/etc, doing just what I wanted, all using the stdlib. Hard to do better than that :-) -tkc