Encoding confusion, please help

Pekka Niiranen pekka.niiranen at wlanmail.com
Sun Nov 14 17:48:16 CET 2004


Probing my system from Python 2.3.4 gives

 >>> import locale, sys
 >>> locale.getdefaultlocale()
('fi_FI', 'cp1252')
 >>> locale.getpreferredencoding()
 >>> sys.getdefaultencoding()

Manual says:

Return the encoding used for text data, according to user preferences...

Return the name of the current default string encoding
used by the Unicode implementation

When should I use locale.getpreferredencoding() and when

Why two different encodings 'cp1252' and 'iso-8859-1' are provided
for my Windows 2000 system?


More information about the Python-list mailing list