Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.005 X-Spam-Evidence: '*H*': 0.99; '*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; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'certain': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'that.': 0.31; '25,': 0.31; 'fixing': 0.31; 'writes:': 0.31; 'case,': 0.35; 'received:google.com': 0.35; 'problems': 0.38; 'does': 0.39; 'sure': 0.39; 'dave': 0.60; "you'll": 0.62; '"just': 0.84; '2015': 0.84; 'angel': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=6Xy9sSWqrofk3RFjjkvxhsUzQj3xK7in8Qf2QAdXgo4=; b=OeDa4N5sZympqrFx3kS+ck8Y9bryhjF+cO4zBNU4438C75jLw3rc27uze8eizIWdbi r+kGwT2K5ZB/o/bCoDcVGtfvu5q7zfGezuaPcgQUXwGWgCAwZYBnhnt/Ba0TeIzD275N RAIm/yz3VNGvSyfGSz6SOU49/EPJNDvMGzL8lh8utqdMKaQUPf/4fdmRGOCIx3C5qG+L VONSneJaitQ29qLHH/HVxSUfZlCY/x/8VvyT/cGOjAF07hnAzUQ2YYMol0WYYNRiSX3Q uGSHAExCuC8je1xnc4Qq9uQzN8fuuTCtDwKLDKqrbz6WzemotF+E8tjX6yTZIRcgnoqh zVDg== MIME-Version: 1.0 X-Received: by 10.107.128.219 with SMTP id k88mr20914969ioi.27.1424790196975; Tue, 24 Feb 2015 07:03:16 -0800 (PST) In-Reply-To: <201502241455.t1OEtffT016452@fido.openend.se> References: <54EC5FA4.6070703@davea.name> <201502241455.t1OEtffT016452@fido.openend.se> Date: Wed, 25 Feb 2015 02:03:16 +1100 Subject: Re: Newbie question about text encoding From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424790205 news.xs4all.nl 2931 [2001:888:2000:d::a6]:57762 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86321 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