encoding problem

digisatori at gmail.com digisatori at gmail.com
Fri Dec 19 07:05:12 EST 2008


The below snippet code generates UnicodeDecodeError.
#!/usr/bin/env python
#--*-- coding: utf-8 --*--
s = 'äöü'
u = unicode(s)


It seems that the system use the default encoding- ASCII to decode the
utf8 encoded string literal, and thus generates the error.

The question is why the Python interpreter use the default encoding
instead of "utf-8", which I explicitly declared in the source.



More information about the Python-list mailing list