From 313a760feded62ba39910bf36fc4d62b56d07858 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 18 Jul 2009 09:47:46 -0400 Subject: 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. --- libbe/encoding.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libbe/encoding.py') 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 -- cgit From 027cda3613f7a81de557d6dd929d0d4de40192a1 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 31 Aug 2009 14:19:40 -0400 Subject: Added docstrings to libbe submodules. Also a few minor tweaks to the module imports. --- libbe/encoding.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libbe/encoding.py') diff --git a/libbe/encoding.py b/libbe/encoding.py index 4af864e..fd513b5 100644 --- a/libbe/encoding.py +++ b/libbe/encoding.py @@ -14,11 +14,17 @@ # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +""" +Support input/output/filesystem encodings (e.g. UTF-8). +""" + import codecs import locale import sys import doctest + ENCODING = None # override get_encoding() output by setting this def get_encoding(): -- cgit