diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-18 09:47:46 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-18 09:47:46 -0400 |
commit | 313a760feded62ba39910bf36fc4d62b56d07858 (patch) | |
tree | f0c9f3b169373ddfb4002fa0f1afa5cf7b47c8c4 /libbe | |
parent | d433366708c7b198d4a43254e502ed3fc64a6fa0 (diff) | |
download | bugseverywhere-313a760feded62ba39910bf36fc4d62b56d07858.tar.gz |
Allow external override of libbe.encoding.get_encoding().
The previous procmail encoding fix failed, because the becommand
execution checks libbe.encoding.get_encoding() on it's own, and got
the procmail encoding. This one works.
Diffstat (limited to 'libbe')
-rw-r--r-- | libbe/encoding.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libbe/encoding.py b/libbe/encoding.py index d603602..4af864e 100644 --- a/libbe/encoding.py +++ b/libbe/encoding.py @@ -19,11 +19,15 @@ import locale import sys import doctest +ENCODING = None # override get_encoding() output by setting this + def get_encoding(): """ Guess a useful input/output/filesystem encoding... Maybe we need seperate encodings for input/output and filesystem? Hmm... """ + if ENCODING != None: + return ENCODING encoding = locale.getpreferredencoding() or sys.getdefaultencoding() if sys.platform != 'win32' or sys.version_info[:2] > (2, 3): encoding = locale.getlocale(locale.LC_TIME)[1] or encoding |