>
> Hello,
>
> I'm wondering about the following behaviour of str() with strings
> containing non-ASCII characters:
>
> str(u'foo') returns 'foo' as expected.
>
> str('lää') returns 'lää' as expected.
>
> str(u'lää') raises UnicodeEncodeError
>
This does not work, because you need an encode
Juho Vuori wrote:
> str(u'lää') raises UnicodeEncodeError
> Is this behaviour sane? Possibly, but not documented at all.
str() on a Unicode string attempts to convert the string to an 8-bit
string using Python's default encoding, which is ASCII. "ä" is not
an ASCII character.
if this problem a
Hello,
I'm wondering about the following behaviour of str() with strings
containing non-ASCII characters:
str(u'foo') returns 'foo' as expected.
str('lää') returns 'lää' as expected.
str(u'lää') raises UnicodeEncodeError
Is this behaviour sane? Possibly, but not documented at all. Somehow
yo