From 287e91523ebfc77ecc0a761b17847d21237034d3 Mon Sep 17 00:00:00 2001 From: Chris Lawrence Date: Fri, 25 Aug 2006 01:18:06 +0000 Subject: [PATCH] UTF-8 fixups. --- debian/changelog | 7 +++++++ reportbug | 9 +++------ reportbug.py | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8690baa..b61f2b4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +reportbug (3.29.1) unstable; urgency=low + + * Fix crashes when maintainer name is UTF-8 encoded. + (Closes: #384423, #384547) + + -- Chris Lawrence Thu, 24 Aug 2006 20:17:42 -0500 + reportbug (3.29) unstable; urgency=low * Send the version header in BTS queries. diff --git a/reportbug b/reportbug index 01db8d3..872e1e3 100755 --- a/reportbug +++ b/reportbug @@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.""" # # Version ##VERSION##; see changelog for revision history -# $Id: reportbug,v 1.98.2.6 2006-08-24 20:34:42 lawrencc Exp $ +# $Id: reportbug,v 1.98.2.7 2006-08-25 01:18:06 lawrencc Exp $ # Work around case where Python install might be broken (#290043) try: @@ -1108,6 +1108,7 @@ class UI(object): (pkgversion, pkgavail, depends, recommends, conffiles, maintainer, installed, origin, vendor, reportinfo, priority, desc, src_name, fulldesc, state) = status + maintainer = maintainer.encode(charset, 'replace') buginfo = '/usr/share/bug/' + package bugexec = submitas = submitto = presubj = None @@ -1303,11 +1304,7 @@ class UI(object): bccaddr = os.environ.get('MAILBCC', fromaddr) if maintainer: - lmaintainer = maintainer - if isinstance(maintainer, str): - lmaintainer = lmaintainer.decode('UTF-8', 'ignore') - lmaintainer = lmaintainer.encode(charset, 'replace') - ewrite("Maintainer for %s is '%s'.\n", package, lmaintainer) + ewrite("Maintainer for %s is '%s'.\n", package, maintainer) if 'qa.debian.org' in maintainer: ui.long_message('''\ This package is currently "orphaned"; if you are a current or prospective diff --git a/reportbug.py b/reportbug.py index fbfa26f..da82938 100644 --- a/reportbug.py +++ b/reportbug.py @@ -21,7 +21,7 @@ # # Version ##VERSION##; see changelog for revision history # -# $Id: reportbug.py,v 1.35.2.2 2006-08-22 16:50:16 lawrencc Exp $ +# $Id: reportbug.py,v 1.35.2.3 2006-08-25 01:18:06 lawrencc Exp $ VERSION = "reportbug ##VERSION##" VERSION_NUMBER = "##VERSION##" @@ -266,7 +266,7 @@ def get_package_status(package, avail=False): "COLUMNS=79 dpkg --status %s 2>/dev/null" % packarg) # dpkg output is in UTF-8 format - output = output.decode('utf-8') + output = output.decode('utf-8', 'replace') for line in output.split(os.linesep): line = line.rstrip()