> Could you send your patch again ? For some reasons the end of several
> lines were truncated. Maybe you could send it again as an attachment.

Sorry, I messed up. Here it goes.
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':

Reply via email to