Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'encoding': 0.05; 'subject:text': 0.05; 'advocate': 0.07; 'laura': 0.07; 'utf-8': 0.07; 'creighton': 0.09; 'subject:question': 0.10; 'cc:addr :python-list': 0.11; '>on': 0.16; 'received:openend.se': 0.16; 'received:theraft.openend.se': 0.16; 'recognise': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'feb': 0.22; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'cc:no real name:2**0': 0.24; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "i'm": 0.30; 'that.': 0.31; '25,': 0.31; 'fixing': 0.31; 'writes:': 0.31; 'case,': 0.35; 'charset:us- ascii': 0.36; 'problems': 0.38; 'does': 0.39; 'sure': 0.39; 'dave': 0.60; 'french': 0.61; "you'll": 0.62; 'header:Message- Id:1': 0.63; 'places': 0.64; 'to:addr:gmail.com': 0.65; '"just': 0.84; '2015': 0.84; 'sporting': 0.84; 'received:89': 0.85; 'angel': 0.91 To: Chris Angelico From: Laura Creighton Subject: Re: Newbie question about text encoding In-Reply-To: Message from Chris Angelico of "Wed, 25 Feb 2015 02:03:16 +1100." References: <54EC5FA4.6070703@davea.name> <201502241455.t1OEtffT016452@fido.openend.se> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18881.1424790456.1@fido> Date: Tue, 24 Feb 2015 16:07:36 +0100 Cc: "python-list@python.org" , lac@openend.se 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424790463 news.xs4all.nl 2883 [2001:888:2000:d::a6]:35003 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86323 In a message of Wed, 25 Feb 2015 02:03:16 +1100, Chris Angelico writes: >On Wed, Feb 25, 2015 at 1:55 AM, Laura Creighton wrote: >> In a message of Tue, 24 Feb 2015 06:25:24 -0500, Dave Angel writes: >>>But utf-8 does not seem to be the right encoding for that bytestring. >>>So you'll need a form like: >>> mystring = rec.decode(encoding='xxx') >>> >>>for some value of xxx. >> >>>DaveA >> >> And the xxx you want is "latin1" > >Can you be sure it's Latin-1? I'm not certain of that. In any case, I >never advocate fixing encoding problems by "just do this and it'll all >go away"; you have to understand your data before you can decode it. > >ChrisA I can, I speak French and I recognise the data. It's French place names, places where sporting events are held. :) Laura