Message24127
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. |
|
| Date |
User |
Action |
Args |
| 2007-08-23 14:29:17 | admin | link | issue1114093 messages |
| 2007-08-23 14:29:17 | admin | create | |
|