From f95e8e1ea9ba2c67d875827382e8feb213a6ab22 Mon Sep 17 00:00:00 2001 From: Ben Carrillo Date: Mon, 11 Feb 2013 05:08:03 +0900 Subject: fix for unicodeencode error on _format_args --- debian/patches/fix-unicodeencode-error | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 debian/patches/fix-unicodeencode-error (limited to 'debian/patches/fix-unicodeencode-error') 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 +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 + + -- cgit v1.2.3