encoding problem
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri Dec 19 08:34:26 EST 2008
On Fri, 19 Dec 2008 04:05:12 -0800, digisatori at gmail.com wrote:
> 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.
Because the declaration is only for decoding unicode literals in that
very source file.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list