From: Paul Menzel Date: Sun, 24 Jan 2010 20:06:57 +0000 (+0100) Subject: pwclient get: fix for handling messages encoded in UTF-8 X-Git-Url: https://git.ozlabs.org/?p=patchwork;a=commitdiff_plain;h=d5edf740c9c2c31fa60c757aa8d66e1dedbab74a pwclient get: fix for handling messages encoded in UTF-8 Trying `pwclient get` with a message containing UTF-8 characters you would get the following error. $ python -v pwclient get ID [...] # trying /usr/lib/python2.5/encodings/ascii.so # trying /usr/lib/python2.5/encodings/asciimodule.so # trying /usr/lib/python2.5/encodings/ascii.py # /usr/lib/python2.5/encodings/ascii.pyc matches /usr/lib/python2.5/encodings/ascii.py import encodings.ascii # precompiled from /usr/lib/python2.5/encodings/ascii.pyc Failed to write to subject.patch [...] You can reproduce it with $ pwclient get http://patchwork.openembedded.org/patch/1440/ and the fix is the same as in 4fc6a16910e595401e919abde28cca436193e0dd by Mauro Carvalho Chehab. Signed-off-by: Paul Menzel --- diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient index b0bd1d1..b480408 100755 --- a/apps/patchwork/bin/pwclient +++ b/apps/patchwork/bin/pwclient @@ -234,7 +234,7 @@ def action_get(rpc, patch_id): sys.exit(1) try: - f.write(s) + f.write(unicode(s).encode("utf-8")) f.close() print "Saved patch to %s" % fname except: