Skip to content

Commit a3ffeeb

Browse files
author
Richard Jones
committed
Eudora can't handle utf-8 headers. We love Eudora. [SF#900046]
1 parent fa56780 commit a3ffeeb

File tree

7 files changed

+43
-11
lines changed

7 files changed

+43
-11
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Cleanup:
7474
2004-??-?? 0.6.6
7575
Fixed:
7676
- don't insert spaces into designators, it just confuses users (sf bug 898087)
77+
- Eudora can't handle utf-8 headers. We love Eudora. (sf bug 900046)
7778

7879

7980
2004-02-16 0.6.5

doc/customizing.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.115 $
5+
:Version: $Revision: 1.116 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -187,6 +187,12 @@ The configuration variables available are:
187187
wish to make them xhtml, then you'll need to change this var to 'xhtml'
188188
too so all auto-generated HTML is compliant.
189189

190+
**EMAIL_CHARSET** - ``utf-8`` (or ``iso-8859-1`` for Eudora users)
191+
Character set to encode email headers with. We use utf-8 by default, as
192+
it's the most flexible. Some mail readers (eg. Eudora) can't cope with
193+
that, so you might need to specify a more limited character set (eg.
194+
'iso-8859-1'.
195+
190196
The default config.py is given below - as you
191197
can see, the MAIL_DOMAIN must be edited before any interaction with the
192198
tracker is attempted.::
@@ -267,6 +273,13 @@ tracker is attempted.::
267273
# too so all auto-generated HTML is compliant.
268274
HTML_VERSION = 'html4' # either 'html4' or 'xhtml'
269275

276+
# Character set to encode email headers with. We use utf-8 by default, as
277+
# it's the most flexible. Some mail readers (eg. Eudora) can't cope with
278+
# that, so you might need to specify a more limited character set (eg.
279+
# 'iso-8859-1'.
280+
EMAIL_CHARSET = 'utf-8'
281+
#EMAIL_CHARSET = 'iso-8859-1' # use this instead for Eudora users
282+
270283
#
271284
# SECURITY DEFINITIONS
272285
#

roundup/mailer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Sending Roundup-specific mail over SMTP.
22
"""
33
__docformat__ = 'restructuredtext'
4-
# $Id: mailer.py,v 1.5 2004-02-11 23:55:08 richard Exp $
4+
# $Id: mailer.py,v 1.6 2004-02-23 05:29:05 richard Exp $
55

66
import time, quopri, os, socket, smtplib, re
77

@@ -29,7 +29,8 @@ def get_standard_message(self, to, subject, author=None):
2929
self.config.ADMIN_EMAIL))
3030
message = StringIO()
3131
writer = MimeWriter(message)
32-
writer.addheader('Subject', encode_header(subject))
32+
writer.addheader('Subject', encode_header(subject,
33+
self.config.EMAIL_CHARSET))
3334
writer.addheader('To', ', '.join(to))
3435
writer.addheader('From', author)
3536
writer.addheader('Date', time.strftime("%a, %d %b %Y %H:%M:%S +0000",

roundup/rfc2822.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def decode_header(hdr):
119119
outs += unicode(section[0], charset or 'iso-8859-1', 'replace')
120120
return outs.encode('utf-8')
121121

122-
def encode_header(header):
122+
def encode_header(header, charset='utf-8'):
123123
""" Will encode in quoted-printable encoding only if header
124124
contains non latin characters
125125
"""
@@ -132,7 +132,6 @@ def encode_header(header):
132132
if hqre.match(header):
133133
return header
134134

135-
charset = 'utf-8'
136135
quoted = ''
137136
#max_encoded = 76 - len(charset) - 7
138137
for c in header:

roundup/roundupdb.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.97 2004-02-11 23:55:08 richard Exp $
18+
# $Id: roundupdb.py,v 1.98 2004-02-23 05:29:05 richard Exp $
1919

2020
"""Extending hyperdb with types specific to issue-tracking.
2121
"""
@@ -268,14 +268,17 @@ def send_message(self, nodeid, msgid, note, sendto, from_address=None):
268268
if from_tag:
269269
from_tag = ' ' + from_tag
270270

271-
subject = '[%s%s] %s' % (cn, nodeid, encode_header(title))
272-
author = straddr((encode_header(authname) + from_tag, from_address))
271+
subject = '[%s%s] %s' % (cn, nodeid, encode_header(title,
272+
self.db.config.EMAIL_CHARSET))
273+
author = straddr((encode_header(authname, self.db.config.EMAIL_CHARSET)
274+
+ from_tag, from_address))
273275

274276
# create the message
275277
mailer = Mailer(self.db.config)
276278
message, writer = mailer.get_standard_message(sendto, subject, author)
277279

278-
tracker_name = encode_header(self.db.config.TRACKER_NAME)
280+
tracker_name = encode_header(self.db.config.TRACKER_NAME,
281+
self.db.config.EMAIL_CHARSET)
279282
writer.addheader('Reply-To', straddr((tracker_name, from_address)))
280283
if messageid:
281284
writer.addheader('Message-Id', messageid)

templates/classic/config.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: config.py,v 1.4 2003-12-06 00:00:54 richard Exp $
18+
# $Id: config.py,v 1.5 2004-02-23 05:29:05 richard Exp $
1919

2020
import os
2121

@@ -111,6 +111,14 @@
111111
# too so all auto-generated HTML is compliant.
112112
HTML_VERSION = 'html4' # either 'html4' or 'xhtml'
113113

114+
# Character set to encode email headers with. We use utf-8 by default, as
115+
# it's the most flexible. Some mail readers (eg. Eudora) can't cope with
116+
# that, so you might need to specify a more limited character set (eg.
117+
# 'iso-8859-1'.
118+
EMAIL_CHARSET = 'utf-8'
119+
#EMAIL_CHARSET = 'iso-8859-1' # use this instead for Eudora users
120+
121+
114122
#
115123
# SECURITY DEFINITIONS
116124
#

templates/minimal/config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: config.py,v 1.3 2003-12-06 00:00:54 richard Exp $
18+
# $Id: config.py,v 1.4 2004-02-23 05:29:06 richard Exp $
1919

2020
import os
2121

@@ -115,4 +115,11 @@
115115
# too so all auto-generated HTML is compliant.
116116
HTML_VERSION = 'html4' # either 'html4' or 'xhtml'
117117

118+
# Character set to encode email headers with. We use utf-8 by default, as
119+
# it's the most flexible. Some mail readers (eg. Eudora) can't cope with
120+
# that, so you might need to specify a more limited character set (eg.
121+
# 'iso-8859-1'.
122+
EMAIL_CHARSET = 'utf-8'
123+
#EMAIL_CHARSET = 'iso-8859-1' # use this instead for Eudora users
124+
118125
# vim: set filetype=python ts=4 sw=4 et si

0 commit comments

Comments
 (0)