Browse Source

Avoid double encoding with python3. Closes: #828833

Christoph Biedl 7 years ago
parent
commit
a76d7df97a

+ 36 - 0
debian/patches/cherry-pick.FILE5_28-10-g73e043d.avoid-double-encoding-with-python3.patch

@@ -0,0 +1,36 @@
+Subject: PR/562: Reiner Herrmann: Avoid double encoding with python3
+Origin: FILE5_28-10-g73e043d
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Tue Jun 28 17:10:22 2016 +0000
+Bug: http://bugs.gw.com/view.php?id=562
+Bug-Debian: https://bugs.debian.org/828833
+
+--- a/python/magic.py
++++ b/python/magic.py
+@@ -134,7 +134,7 @@
+         if isinstance(r, str):
+             return r
+         else:
+-            return str(r).encode('utf-8')
++            return str(r, 'utf-8')
+ 
+     def descriptor(self, fd):
+         """
+@@ -152,7 +152,7 @@
+         if isinstance(r, str):
+             return r
+         else:
+-            return str(r).encode('utf-8')
++            return str(r, 'utf-8')
+ 
+     def error(self):
+         """
+@@ -163,7 +163,7 @@
+         if isinstance(e, str):
+             return e
+         else:
+-            return str(e).encode('utf-8')
++            return str(e, 'utf-8')
+ 
+     def setflags(self, flags):
+         """

+ 1 - 0
debian/patches/series

@@ -1,6 +1,7 @@
 # cherry-picked commits. Keep in chronlogical order
 cherry-pick.FILE5_28-6-g0971151.reduce-the-number-of-x-s-to-appease-linitian.patch
 cherry-pick.FILE5_28-9-g1222ebc.dont-copy-null-igor-gnatenko.patch
+cherry-pick.FILE5_28-10-g73e043d.avoid-double-encoding-with-python3.patch
 
 # local modifications
 local.support-local-definitions-in-etc-magic.patch