How do I encode and decode this data to write to a file?

cl at isbd.net cl at isbd.net
Mon Apr 29 08:50:01 EDT 2013


Andrew Berg <bahamutzero8825 at gmail.com> wrote:
> On 2013.04.29 04:47, cl at 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



More information about the Python-list mailing list