[Reportbug-commits] r580 - in trunk (debian/changelog reportbug)

lawrencc at users.alioth.debian.org lawrencc at users.alioth.debian.org
Thu Jul 24 18:50:17 UTC 2008


    Date: Thursday, July 24, 2008 @ 18:50:15
  Author: lawrencc
Revision: 580

Apply patch from Flavio Grossi fixing yet another character encoding
bug.  Closes: #492240

Modified:
  trunk/debian/changelog
  trunk/reportbug

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-07-17 18:44:30 UTC (rev 579)
+++ trunk/debian/changelog	2008-07-24 18:50:15 UTC (rev 580)
@@ -1,3 +1,11 @@
+reportbug (3.44) UNRELEASED; urgency=low
+
+  [ Chris Lawrence ]
+  * reportbug
+    + Yet another character set issue fix.  (Closes: #492240)
+
+ --
+
 reportbug (3.43) unstable; urgency=medium
 
   [ Ben Finney ]

Modified: trunk/reportbug
===================================================================
--- trunk/reportbug	2008-07-17 18:44:30 UTC (rev 579)
+++ trunk/reportbug	2008-07-24 18:50:15 UTC (rev 580)
@@ -96,7 +96,7 @@
 
 def include_file_in_report(message, message_filename,
                            attachment_filenames, package_name,
-                           include_filename, inline=False):
+                           include_filename, charset, inline=False):
     """ Include a file in the report.
 
         :parameters:
@@ -123,11 +123,13 @@
     if inline:
         try:
             fp = file(include_filename)
-            message += '\n*** %s\n%s' % (include_filename, fp.read())
+            message += '\n*** %s\n%s' % (
+                       include_filename.decode(charset, 'replace'),
+                       fp.read().decode(charset, 'replace'))
             fp.close()
             fp, temp_filename = TempFile(
                 prefix=tempfile_prefix(package_name))
-            fp.write(message)
+            fp.write(message.encode(charset, 'replace'))
             fp.close()
             os.unlink(message_filename)
             message_filename = temp_filename
@@ -224,7 +226,7 @@
                         inline = (x == 'i')
                         (message, filename, attachments) = include_file_in_report(
                             message, filename, attachments, package,
-                            attachfile, inline=inline)
+                            attachfile, charset, inline=inline)
                         if not inline:
                             skip_editing = True
                     else:
@@ -1062,7 +1064,9 @@
             for f in self.options.include:
                 if os.path.exists(f):
                     fp = file(f)
-                    incfiles = u'%s\n*** %s\n%s' % (incfiles, f, fp.read().decode('utf-8', 'replace'))
+                    incfiles = u'%s\n*** %s\n%s' % (
+                               incfiles, f.decode('utf-8', 'replace'),
+                               fp.read().decode('utf-8', 'replace'))
                     fp.close()
                 else:
                     ewrite("Can't find %s to include!\n", f)




More information about the Reportbug-commits mailing list