cherry-pick.FILE5_28-10-g73e043d.avoid-double-encoding-with-python3.patch 952 B

123456789101112131415161718192021222324252627282930313233343536
  1. Subject: PR/562: Reiner Herrmann: Avoid double encoding with python3
  2. Origin: FILE5_28-10-g73e043d
  3. Upstream-Author: Christos Zoulas <christos@zoulas.com>
  4. Date: Tue Jun 28 17:10:22 2016 +0000
  5. Bug: http://bugs.gw.com/view.php?id=562
  6. Bug-Debian: https://bugs.debian.org/828833
  7. --- a/python/magic.py
  8. +++ b/python/magic.py
  9. @@ -134,7 +134,7 @@
  10. if isinstance(r, str):
  11. return r
  12. else:
  13. - return str(r).encode('utf-8')
  14. + return str(r, 'utf-8')
  15. def descriptor(self, fd):
  16. """
  17. @@ -152,7 +152,7 @@
  18. if isinstance(r, str):
  19. return r
  20. else:
  21. - return str(r).encode('utf-8')
  22. + return str(r, 'utf-8')
  23. def error(self):
  24. """
  25. @@ -163,7 +163,7 @@
  26. if isinstance(e, str):
  27. return e
  28. else:
  29. - return str(e).encode('utf-8')
  30. + return str(e, 'utf-8')
  31. def setflags(self, flags):
  32. """