Opened 17 years ago
Last modified 17 years ago
#4835 closed enhancement
fix for bad contrib/emailfilter.py encoding behaviour — at Initial Version
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | general | Version: | |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
when submitting tickets via e-mail using the emailfilter.py, it caused trac to crash. the reason was that it inserted non-utf8 content into the database. the attached diff should fix that:
@@ -53,7 +53,10 @@
tktsummary = msgsubject for part in msg.walk():
if part.get_content_type() == 'text/plain':
- tktdescription = part.get_payload(decode=1).strip()
+ ch = part.get_content_charset() + payload = part.get_payload(decode=True).strip() + plain = unicode(payload, ch).encode('utf-8') + tktdescription = plain
if tkt.values.get('description'):
tkt.insert()