Hardcoded UTF-8 encoding in be-handle-mail.
authorW. Trevor King <wking@drexel.edu>
Sat, 18 Jul 2009 13:31:44 +0000 (09:31 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 18 Jul 2009 13:31:44 +0000 (09:31 -0400)
When run by procmail, the encoding returned by
libbe.encoding.get_encoding is ANSI_X3.4-1968, which chokes on unicode
output.  I can't think of a more elegant solution than hardcoding in
the default encoding.

interfaces/email/interactive/be-handle-mail

index d8aafb27cc7a3eba834b7cea93e9282c1cf05fab..e8de7ca2bc86f5da176bae2237169688eec60110 100755 (executable)
@@ -46,7 +46,8 @@ _THIS_DIR = os.path.abspath(os.path.dirname(__file__))
 BE_DIR = _THIS_DIR
 LOGPATH = os.path.join(_THIS_DIR, "be-handle-mail.log")
 LOGFILE = None
-ENCODING = libbe.encoding.get_encoding()
+#ENCODING = libbe.encoding.get_encoding()
+ENCODING = "utf-8"
 
 ALLOWED_COMMANDS = ["new", "comment", "list", "show", "help"]
 
@@ -232,7 +233,8 @@ def open_logfile(logpath=None):
             LOGPATH = os.path.join(_THIS_DIR, logpath)
     if LOGFILE == None and LOGPATH != "none":
         LOGFILE = codecs.open(LOGPATH, "a+", ENCODING)
-    
+    LOGFILE.write("Default encoding: %s\n" % ENCODING)
+
 def close_logfile():
     if LOGFILE != None and LOGPATH not in ["stderr", "none"]:
         LOGFILE.close()