Lie Ryan wrote:
> On 01/12/10 23:50, Jens Müller wrote:
>>> To convert unicode into str you have to *encode()* it.
>>>
>>> u"...".decode(...) will implicitly convert to ASCII first, i. e. is
>>> equivalent to
>>>
>>> u"...".encode("ascii").decode(...)
>>>
>>> Hence the error message
>>
>> Ah - ye
On 01/12/10 23:50, Jens Müller wrote:
>> To convert unicode into str you have to *encode()* it.
>>
>> u"...".decode(...) will implicitly convert to ASCII first, i. e. is
>> equivalent to
>>
>> u"...".encode("ascii").decode(...)
>>
>> Hence the error message
>
> Ah - yes of course.
>
> And how can
To convert unicode into str you have to *encode()* it.
u"...".decode(...) will implicitly convert to ASCII first, i. e. is
equivalent to
u"...".encode("ascii").decode(...)
Hence the error message
Ah - yes of course.
And how can you use the system's default encoding with errors=ignore?
The de
Jens Müller wrote:
> I try to decode a string,e.g.
> u'M\xfcnchen, pronounced [\u02c8m\u028fn\xe7\u0259n]'.decode('cp1252',
> 'ignore')
> but even thoug I use errors='ignore'
> I get UnicodeEncodeError: 'charmap' codec can't encode character u'\u02c8'
> in position 21: character maps to
>
> How c
Jens Müller wrote:
> I try to decode a string,e.g.
> u'M\xfcnchen, pronounced [\u02c8m\u028fn\xe7\u0259n]'.decode('cp1252',
> 'ignore')
> but even thoug I use errors='ignore'
> I get UnicodeEncodeError: 'charmap' codec can't encode character u'\u02c8'
> in position 21: character maps to
>
> How
Hi,
I try to decode a string,e.g.
u'M\xfcnchen, pronounced [\u02c8m\u028fn\xe7\u0259n]'.decode('cp1252',
'ignore')
but even thoug I use errors='ignore'
I get UnicodeEncodeError: 'charmap' codec can't encode character u'\u02c8'
in position 21: character maps to
How come?
Thanks,
Jens
--