error when printing a UTF-8 string (python 2.6.2)
__peter__ at web.de
Wed Apr 21 15:29:33 CEST 2010
python at bdurham.com wrote:
> Are you saying all open() calls in Python that read text files,
> automatically convert UTF-8 content to Unicode in the same manner as the
> following might when using Python 2.6?
> codecs.open( fileName, mode='r', encoding='UTF8', ... )
That's what I meant to say, but it's not actually true.
open(file, mode='r', buffering=None, encoding=None, errors=None,
encoding is the name of the encoding used to decode or encode the file. This
should only be used in text mode. The default encoding is platform dependent
(whatever locale.getpreferredencoding() returns), but any encoding supported
by Python can be used. See the codecs module for the list of supported
So it just happend to be UTF-8 on my machine.
More information about the Python-list