Update of /cvsroot/tmda/tmda/TMDA
In directory usw-pr-cvs1:/tmp/cvs-serv26300/TMDA

Modified Files:
        ChangeLog Util.py 
Log Message:
Better multi-lingual support for tmda-pending.

When displaying message summaries, tmda-pending wasn't paying
attention to headers with charset encoded parts, which left them
unreadable for the user.  e.g,

-----
1030037255.24196.msg (59 of 959 / 17942 bytes)
  >> Date: Fri, 23 Aug 2002 02:26:47 +0900
  >> From: =?ks_c_5601-1987?B?x/a068SrteU=?= <[EMAIL PROTECTED]>
  >>   To: [EMAIL PROTECTED]
  >> Subj: 
=?ks_c_5601-1987?B?W7GksO1dIG5vdmVtYnJltNQgx+C/7sDHILPXwNkgxay3zrnZv80gurmxx8C7ILXluLO0z7TZIQ==?=
([p]ass / [s]how / [r]el / [d]el / [w]hite / [b]lack / [q]uit) [pass]: 
-----

We now run the headers through an RFC 2047 decoder before display.
This even works for multibyte character sets.

Problem reported by Jinhyok Heo in
<[EMAIL PROTECTED]> on tmda-users.


Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.228
retrieving revision 1.229
diff -u -r1.228 -r1.229
--- ChangeLog   13 Sep 2002 05:42:11 -0000      1.228
+++ ChangeLog   21 Sep 2002 00:27:43 -0000      1.229
@@ -1,3 +1,7 @@
+2002-09-20  Jason R. Mastaler  <[EMAIL PROTECTED]>
+
+       * Util.py (decode_header): New function.
+
 2002-09-12  Jason R. Mastaler  <[EMAIL PROTECTED]>
 
        * Util.py (formataddr): Remove function.

Index: Util.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Util.py,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- Util.py     13 Sep 2002 00:22:36 -0000      1.68
+++ Util.py     21 Sep 2002 00:27:43 -0000      1.69
@@ -449,6 +449,24 @@
     return object
 
 
+def decode_header(str):
+    """Accept a possibly encoded message header as a string, and
+    return a decoded string.
+
+    JRM: email.Header has a decode_header method, but it returns a
+    list of decoded pairs, one for each part of the header, which is
+    an awkward interface IMO, especially when the header contains a
+    mix of encoded and non-encoded parts.
+    """
+    from email import Header
+    parts = []
+    pairs = Header.decode_header(str)
+    for pair in pairs:
+        parts.append(pair[0])
+    decoded_string = ' '.join(parts)
+    return decoded_string
+
+
 def findmatch(list, addrs):
     """Determine whether any of the passed e-mail addresses match a
     Unix shell-style wildcard pattern contained in list.  The

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to