summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-08-27 14:35:51 +0200
committerGuido Günther <agx@sigxcpu.org>2017-08-27 14:35:51 +0200
commit9dc2129c4448416f43300ce859f1e1f4a1070048 (patch)
treeddec9913435ebe850bd901dc4d3fa9e13fd74ac5
parent19310dc5d6b9a0fa8bacf3ccdc60dc61049e500b (diff)
pq: properly retry non-ascii charset on patch body encode
The current code tried to catch the wrong exception
-rw-r--r--gbp/scripts/common/pq.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py
index cf98a6cb..ed56c6da 100644
--- a/gbp/scripts/common/pq.py
+++ b/gbp/scripts/common/pq.py
@@ -170,7 +170,7 @@ def write_patch_file(filename, commit_info, diff):
body = commit_info['body'].rstrip() + '\n'
try:
msg.set_payload(body.encode('us-ascii'))
- except UnicodeDecodeError:
+ except UnicodeEncodeError:
msg.set_payload(body, charset)
patch.write(msg.as_string(unixfrom=False, maxheaderlen=77).encode('utf-8'))