From 90cf692002ba35728385ee0bfacab578944bdd82 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Fri, 28 Nov 2014 12:46:22 -0800 Subject: Fixed a UnicodeDecodeError that could occur in the web admin interface if 'text' valued attributes have unicode values. --- Mailman/htmlformat.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Mailman') diff --git a/Mailman/htmlformat.py b/Mailman/htmlformat.py index 74dd276f..d02780d1 100755 --- a/Mailman/htmlformat.py +++ b/Mailman/htmlformat.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2012 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2014 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -32,7 +32,7 @@ import types from Mailman import mm_cfg from Mailman import Utils -from Mailman.i18n import _ +from Mailman.i18n import _, get_translation from Mailman.CSRFcheck import csrf_token @@ -441,6 +441,7 @@ class InputObj: self.kws = kws def Format(self, indent=0): + charset = get_translation().charset() or 'us-ascii' output = ['') - return SPACE.join(output) + ret = SPACE.join(output) + if self.type == 'TEXT' and isinstance(ret, unicode): + ret = ret.encode(charset, 'replace') + return ret class SubmitButton(InputObj): @@ -486,6 +490,7 @@ class TextArea: self.readonly = readonly def Format(self, indent=0): + charset = get_translation().charset() or 'us-ascii' output = '