Decoding not reversing unicode encoding in Django/Python
Posted
by PhilGo20
on Stack Overflow
See other posts from Stack Overflow
or by PhilGo20
Published on 2010-04-12T20:43:25Z
Indexed on
2010/04/12
21:42 UTC
Read the original article
Hit count: 463
Ok, I have a hardcoded string I declare like this
name = u"Par Catégorie"
I have a # -- coding: utf-8 -- magic header, so I am guessing it's converted to utf-8
Down the road it's outputted to xml through
xml_output.toprettyxml(indent='....', encoding='utf-8')
And I get a
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
Most of my data is in French and is ouputted correctly in CDATA nodes, but that one harcoded string keep ... I don't see why an ascii codec is called.
what's wrong ?
© Stack Overflow or respective owner