summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/patches/fix-unicodeencode-error19
-rw-r--r--debian/patches/series1
2 files changed, 20 insertions, 0 deletions
diff --git a/debian/patches/fix-unicodeencode-error b/debian/patches/fix-unicodeencode-error
new file mode 100644
index 0000000..821ceb9
--- /dev/null
+++ b/debian/patches/fix-unicodeencode-error
@@ -0,0 +1,19 @@
+Description: fix for _format arg function raising UnicodeDecodeError if DEFAULT_ENCODING cannot encode unicode characters
+Author: Ben Carrillo <ben@futeisha.org>
+Bug: XXX
+Forwarded: yes
+--- a/sh.py
++++ b/sh.py
+@@ -561,7 +561,11 @@
+ # if the argument is already unicode, or a number or whatever,
+ # this first call will fail.
+ try: arg = unicode(arg, DEFAULT_ENCODING).encode(DEFAULT_ENCODING)
+- except TypeError: arg = unicode(arg).encode(DEFAULT_ENCODING)
++ except TypeError:
++ try:
++ arg = unicode(arg).encode(DEFAULT_ENCODING)
++ except UnicodeEncodeError:
++ arg = unicode(arg).encode('utf-8')
+ return arg
+
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..bbbde28
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix-unicodeencode-error