Update of /cvsroot/tmda/tmda/TMDA
In directory usw-pr-cvs1:/tmp/cvs-serv15428/TMDA
Modified Files:
AutoResponse.py
Log Message:
Bug workaround. If in your template, you include the original subject
in your Subject line, e.g:
Subject.US-ASCII: Please confirm your message (Re: %(subject)s)
And the incoming message has an encoded subject that your Python
can't decode (e.g, BIG5, EUC-KR), a LookupError will be raised.
As a temporary workaround, now we don't attempt any decoding if
the specified charset for Subject is US-ASCII.
This means that users who use a non-ASCII Subject field in their
template, _and_ also include the original subject will still have
this problem as decoding will be attempted. e.g,
Subject.LATIN-1: Bitte Best�tigen (Re: %(subject)s)
This patch covers the majority of users though, and buys us some time
until a real solution can be found. Unfortunately, this is a rather
difficult problem to solve. For details on why, see the thread
starting at:
http://article.gmane.org/gmane.comp.python.mime.devel/342
Until (if?) we fix this, users who report this problem will have a few
options to choose from:
1) Use only US-ASCII in the Subject field.
2) Remove %(subject)s from the Subject field.
3) Install ChineseCodecs, JapaneseCodecs, and KoreanCodecs.
4) Once the above Codecs ship with Python, upgrade to that version of
Python.
Hmm, perhaps it's not the end of the world if we can't figure this one
out, as there are still some options for the user.
This bug was reported by Martin Klaffenboeck in
<[EMAIL PROTECTED]> on tmda-users.
Index: AutoResponse.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/AutoResponse.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AutoResponse.py 4 Nov 2002 02:49:24 -0000 1.5
+++ AutoResponse.py 10 Nov 2002 04:07:10 -0000 1.6
@@ -147,19 +147,20 @@
hdrcharset = ksplit[1]
# headers like `From:' which contain e-mail addresses
# might need the "Fullname" portion encoded, but the
- # address portion must _not_ be encoded.
+ # address portion must never be encoded.
if k.lower() in map(lambda s: s.lower(),
Defaults.TEMPLATE_EMAIL_HEADERS):
name, addr = parseaddr(v)
- if name:
+ if name and hdrcharset.lower() not in ('ascii', 'us-ascii'):
h = Header(name, hdrcharset)
name = h.encode()
self.mimemsg[k] = formataddr((name, addr))
# headers like `Subject:' might contain an encoded string,
# so we need to decode that first before encoding the
# entire header value.
- elif k.lower() in map(lambda s: s.lower(),
- Defaults.TEMPLATE_ENCODED_HEADERS):
+ elif hdrcharset.lower() not in ('ascii', 'us-ascii') and \
+ k.lower() in map(lambda s: s.lower(),
+ Defaults.TEMPLATE_ENCODED_HEADERS):
h = Header(charset=hdrcharset, header_name=k)
decoded_seq = decode_header(v)
for s, charset in decoded_seq:
_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs