summaryrefslogtreecommitdiff
path: root/Mailman/Utils.py
diff options
context:
space:
mode:
authortkikuchi2007-03-02 12:36:15 +0000
committertkikuchi2007-03-02 12:36:15 +0000
commita39a27fce459fb6fc4d0c1ee17ab571d51bf16bf (patch)
tree97824a5764d9924e283ba0c2c94e39bc6cd0a3b1 /Mailman/Utils.py
parent173997db20a1fad4ec6a78e0c7a88e147869cd7d (diff)
downloadmailman-a39a27fce459fb6fc4d0c1ee17ab571d51bf16bf.tar.gz
mailman-a39a27fce459fb6fc4d0c1ee17ab571d51bf16bf.tar.zst
mailman-a39a27fce459fb6fc4d0c1ee17ab571d51bf16bf.zip
Fixes for i18n digest to work.
Mailman/Queue/Switchboard.py: listname is returned in unicode. ( '\x80' + 'a' is OK, '\x80' + u'a' is NG) Mailman/Utils.py: Utils.oneline() is extended for returning unicode string. Mailman/Digester.py: next_post_number is not used anywhere. Mailman/database/listdata.py: Attributes added (esp. for non web u/i) Mailman/bin/senddigests.py: Initialization Mailman/Handlers/ToDigest.py: Internal string calculation is done in unicode. So, several fixes. StringIO is used because cStringIO doesn't have encoding attribute.
Diffstat (limited to 'Mailman/Utils.py')
-rw-r--r--Mailman/Utils.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index 5844d708c..958a3e959 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -826,13 +826,16 @@ def uquote(s):
return str(EMPTYSTRING.join(a))
-def oneline(s, cset):
+def oneline(s, cset='us-ascii', in_unicode=False):
# Decode header string in one line and convert into specified charset
try:
h = email.Header.make_header(email.Header.decode_header(s))
ustr = h.__unicode__()
line = UEMPTYSTRING.join(ustr.splitlines())
- return line.encode(cset, 'replace')
+ if in_unicode:
+ return line
+ else:
+ return line.encode(cset, 'replace')
except (LookupError, UnicodeError, ValueError, HeaderParseError):
# possibly charset problem. return with undecoded string in one line.
return EMPTYSTRING.join(s.splitlines())