Author lemburg
Recipients
Date 2005-02-01.17:23:36
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=38388

What the .encode() and .decode() methods do depends on the
codec being used. 

In your example, the Latin-1 codec is used which is a codec
that encodes from Unicode to 8-bit character strings and
decodes the other way around. As a result the Unicode string
in your first example is first converted to an 8-bit string
using the default encoding (which is ASCII) and this fails.
Same in the second case: Python tries to convert the 8-bit
string to Unicode but this fails since the string contains
non-ASCII characters.

If you switch the types of the strings in both examples,
you'll have no problem at all.
History
Date User Action Args
2007-08-23 14:29:17adminlinkissue1114093 messages
2007-08-23 14:29:17admincreate