Encoding confusion, please help
Pekka Niiranen
pekka.niiranen at wlanmail.com
Sun Nov 14 11:48:16 EST 2004
Hi,
Probing my system from Python 2.3.4 gives
>>> import locale, sys
>>> locale.getdefaultlocale()
('fi_FI', 'cp1252')
>>> locale.getpreferredencoding()
'cp1252'
>>> sys.getdefaultencoding()
'iso-8859-1'
Manual says:
locale.getpreferredencoding():
Return the encoding used for text data, according to user preferences...
sys.getdefaultencoding()
Return the name of the current default string encoding
used by the Unicode implementation
When should I use locale.getpreferredencoding() and when
sys.getdefaultencoding()?
Why two different encodings 'cp1252' and 'iso-8859-1' are provided
for my Windows 2000 system?
-pekka-
More information about the Python-list
mailing list