The previous patch is still not sufficient if there are non-ascii
characters in the name, for example. Explicitly choosing utf-8 character
encoding makes it work.
>From 95f5fcb92086110e23a3611beae550397ad49801 Mon Sep 17 00:00:00 2001
From: Nis Martensen <nis.marten...@web.de>
Date: Fri, 30 Dec 2016 14:11:24 +0100
Subject: [PATCH 2/4] Port bug script to python3

---
 share/script | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/share/script b/share/script
index e64c5e9..0b81135 100755
--- a/share/script
+++ b/share/script
@@ -1,31 +1,31 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 # -*- python -*-
 
 import os
 import re
 
-OUT=os.fdopen(3, 'w')
+OUT=os.fdopen(3, 'w', encoding='utf-8')
 
 envprint = False
 for var in ['EDITOR', 'PAGER', 'VISUAL', 'REPORTBUGEMAIL', 'DEBEMAIL', 'EMAIL',
             'DEBFULLNAME', 'DEBNAME', 'NAME', 'INTERFACE']:
     if var in os.environ:
         if not envprint:
-            print >> OUT, '** Environment settings:'
+            print('** Environment settings:', file=OUT)
             envprint = True
-        print >> OUT, '%s="%s"' % (var, os.environ[var])
+        print('%s="%s"' % (var, os.environ[var]), file=OUT)
 
 passwdre = re.compile(r'\s*(smtppasswd)\s+(.*)$')
 
 USERFILE = os.path.expanduser('~/.reportbugrc')
 if os.path.exists(USERFILE):
     if envprint:
-        print >> OUT
-    print >> OUT, '** %s:' % USERFILE
-    for line in file(USERFILE):
+        print(file=OUT)
+    print('** %s:' % USERFILE, file=OUT)
+    for line in open(USERFILE, 'r', encoding='utf-8'):
         line = line.strip()
         if line and not line.startswith('#'):
             m = passwdre.match(line)
             if m:
                 line = '%s <omitted>' % m.group(1)
-            print >> OUT, line
+            print(line, file=OUT)
-- 
2.1.4

>From 0d8d4e36f81ed97168da45b254b15e502ac3891e Mon Sep 17 00:00:00 2001
From: Nis Martensen <nis.marten...@web.de>
Date: Sat, 31 Dec 2016 11:36:00 +0100
Subject: [PATCH 3/4] Update bug control file to binary package change

---
 share/control | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/share/control b/share/control
index 49ceaa0..4e3e8d1 100644
--- a/share/control
+++ b/share/control
@@ -1 +1 @@
-Report-with: python-reportbug
\ No newline at end of file
+Report-with: python3-reportbug
-- 
2.1.4

Reply via email to