On Fri, 19 Dec 2008 04:05:12 -0800, digisat...@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 -- http://mail.python.org/mailman/listinfo/python-list