[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 4.4-23-g38fabb7

Sandro Tosi morph at debian.org
Tue Jun 16 18:33:48 UTC 2009


The following commit has been merged in the master branch:
commit 38fabb76e0e2c2a1441727cd82b6d335b03b4713
Author: Sandro Tosi <morph at debian.org>
Date:   Tue Jun 16 20:33:12 2009 +0200

      - try to decode BTS page as they are parsed, replacing bad UTF-8 character;
        this will solve all those UTF-8 conversion problems; thanks to Alexandre
        Rossi for the report and patch; Closes: #531911

diff --git a/debian/changelog b/debian/changelog
index 7cc3108..e3510dd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -34,10 +34,10 @@ reportbug (4.5) UNRELEASED; urgency=low
   * share/presubj
     - clarified to include the reportbug output when reporting bug agains us;
       thanks for the suggestion to Reuben Thomas (from #532295)
-  * reportbug/ui/text_ui.py
-    - let characterd be replaced with '?' if they can't be represented by UTF8;
-      thanks to Alexandre Rossi for the report and to Carl Chenet for the patch;
-      Closes: #531911
+  * reportbug/{debianbts.py, ui/text_ui.py}
+    - try to decode BTS page as they are parsed, replacing bad UTF-8 character;
+      this will solve all those UTF-8 conversion problems; thanks to Alexandre
+      Rossi for the report and patch; Closes: #531911
 
   [ Luca Bruno ]
   * reportbug/ui/gtk2_ui.py:
@@ -46,7 +46,7 @@ reportbug (4.5) UNRELEASED; urgency=low
     - check whether the progress bar is present or not before dropping it in
       the bug page; thanks to Arian Sanusi for the report; Closes: #530686
 
- -- Sandro Tosi <morph at debian.org>  Mon, 08 Jun 2009 15:46:12 +0200
+ -- Sandro Tosi <morph at debian.org>  Tue, 16 Jun 2009 20:31:28 +0200
 
 reportbug (4.4) unstable; urgency=low
 
diff --git a/reportbug/debianbts.py b/reportbug/debianbts.py
index 169e4c9..212a7ee 100644
--- a/reportbug/debianbts.py
+++ b/reportbug/debianbts.py
@@ -929,6 +929,11 @@ def get_cgi_reports(package, system='debian', http_proxy='', archived=False,
 
     parser = BTSParser(cgi=True)
     for line in page:
+        try:
+            line = line.decode('utf-8') # BTS pages are encoded in utf-8
+        except UnicodeDecodeError:
+            # page has a bad char
+            line = line.decode('utf-8', 'replace')
         parser.feed(line)
     parser.close()
     try:
diff --git a/reportbug/ui/text_ui.py b/reportbug/ui/text_ui.py
index 15db2b7..e6f7360 100644
--- a/reportbug/ui/text_ui.py
+++ b/reportbug/ui/text_ui.py
@@ -613,7 +613,7 @@ def browse_bugs(hierarchy, count, bugs, bts, queryonly, mirrors,
 
                 while 1:
                     for line in lastpage:
-                        sys.stderr.write(line.decode('utf-8', "replace").encode(output_encoding, "replace"))
+                        sys.stderr.write(line.encode(output_encoding, "replace"))
                     x = select_options(pstr, options, helptext,
                                        allow_numbers=allowed)
                     if x == 'n':

-- 
Reportbug - reports bugs in the Debian distribution



More information about the Reportbug-commits mailing list