Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: cl@isbd.net Newsgroups: comp.lang.python Subject: Re: How do I encode and decode this data to write to a file? Date: Mon, 29 Apr 2013 13:50:01 +0100 Lines: 25 Message-ID: References: <27s15a-943.ln1@chris.zbmc.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net QisIHt9yLN4gLRgi693XaA5IORVfUrs2NIf/thcpiy3wu8vFs= X-Orig-Path: not-for-mail Cancel-Lock: sha1:c6sfsDsASjmDD5z/0ktOqk37sbY= sha1:cQ5pkAHRK1eQWrpZYIIeLWnP9pM= User-Agent: tin/2.1.1-20120623 ("Mulindry") (UNIX) (Linux/3.5.0-27-generic (x86_64)) Xref: csiph.com comp.lang.python:44501 Andrew Berg wrote: > On 2013.04.29 04:47, cl@isbd.net wrote: > > If I understand correctly the encode() is saying that it can't > > understand the data in the html because there's a character 0xc3 in it. > > I *think* this means that the é is encoded in UTF-8 already in the > > incoming data stream (should be as my system is wholly UTF-8 as far as I > > know and I created the directory name). > You can verify that your filesystem is set to use UTF-8 with sys.getfilesystemencoding(). > If it returns 'ascii', then your locale settings > are incorrect. > chris$ python Python 2.7.3 (default, Sep 26 2012, 21:51:14) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.getfilesystemencoding() 'UTF-8' >>> So I am set up right for UTF-8. -- Chris Green