3 """Define useful encoding-extraction functions.
11 """Guess a useful input/output/filesystem encoding.
13 Maybe we need seperate encodings for input/output and filesystem?
16 encoding = locale.getpreferredencoding() or sys.getdefaultencoding()
17 if sys.platform != 'win32' or sys.version_info[:2] > (2, 3):
18 encoding = locale.getlocale(locale.LC_TIME)[1] or encoding
19 # Python 2.3 on windows doesn't know about 'XYZ' alias for 'cpXYZ'
22 def get_input_encoding():
23 "Guess the input encoding."
26 def get_output_encoding():
27 "Guess the output encoding."
30 def get_filesystem_encoding():
31 "Guess the filesystem encoding."