tag 497641 +patch
thanks

  Hello,

  I was starting to get decently fed up with reportbug/querybts choking
on every second package, so I had a look... Here is a simple fix. I
checked that it works both with a latin-1 and an utf-8 locale. I believe
it just does the trick (I'm not a great python coder, let's face it).

  However, as you don't really handle encoding of strings, you'll run
into the same problem another day. They best would be to convert the
strings into Unicode at the source (right after you download them from
the BTS). I can have a look into that and submit another patch if you wish.

  Hope this helps, and I hope you'll fix that quickly, as it simply
makes reportbug/querybts mostly unsable on systems where the encoding
isn't the one from bugs.debian.org (I'm tempted to raise the severity
just for that).

  Cheers,

        Vincent

-- 
Vincent Fourmond, Debian Developer
http://vince-debian.blogspot.com/

More than any other time in history, mankind faces a crossroads.
One path leads to despair and utter hopelessness.
The other, to total extinction.
Let us pray we have the wisdom to choose correctly.
 -- Woody Allen

Vincent, listening to Namehanje (Abdullah Ibrahim)
diff -Nru reportbug-3.99.0/reportbug/ui/text_ui.py 
reportbug-3.99.0+nmu1/reportbug/ui/text_ui.py
--- reportbug-3.99.0/reportbug/ui/text_ui.py    2008-10-23 14:10:23.000000000 
+0200
+++ reportbug-3.99.0+nmu1/reportbug/ui/text_ui.py       2008-10-27 
20:49:36.000000000 +0100
@@ -30,6 +30,7 @@
 import glob
 import getpass
 import textwrap
+import locale
 try:
     import readline
 except ImportError:
@@ -518,6 +519,7 @@
 
 def browse_bugs(hierarchy, count, bugs, bts, queryonly, mirrors,
                 http_proxy, screen, title):
+    output_encoding = locale.getpreferredencoding()
     endcount = catcount = 0
     scount = startcount = 1
     category = hierarchy[0]
@@ -582,7 +584,8 @@
                     helptext['n'] = helptext['n'][:-1]+' (skip to Next page).'
 
                 while 1:
-                    sys.stderr.writelines(lastpage)
+                    for line in lastpage:
+                        
sys.stderr.write(line.decode('utf-8').encode(output_encoding, "replace"))
                     x = select_options(pstr, options, helptext,
                                        allow_numbers=allowed)
                     if x == 'n':

Reply via email to