From patchwork Mon Mar 13 21:19:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 738435 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vhrkj55pDz9s2G for ; Tue, 14 Mar 2017 08:35:25 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vhrkj494dzDqYR for ; Tue, 14 Mar 2017 08:35:25 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org X-Greylist: delayed 929 seconds by postgrey-1.36 at bilbo; Tue, 14 Mar 2017 08:35:14 AEDT Received: from exchange.essensium.com (220.77.144.195.ipv4.evonet.be [195.144.77.220]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vhrkV6yxmzDqXf for ; Tue, 14 Mar 2017 08:35:14 +1100 (AEDT) Received: from localhost.localdomain (10.3.7.11) by beleexch01.local.ess-mail.com (10.3.7.8) with Microsoft SMTP Server (TLS) id 15.0.847.32; Mon, 13 Mar 2017 22:19:14 +0100 From: "Arnout Vandecappelle (Essensium/Mind)" To: Subject: [PATCH] pwclient: do proper utf-8 encoding of all RPC responses Date: Mon, 13 Mar 2017 22:19:10 +0100 Message-ID: <20170313211910.1212-1-arnout@mind.be> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Originating-IP: [10.3.7.11] X-ClientProxiedBy: beleexch01.local.ess-mail.com (10.3.7.8) To beleexch01.local.ess-mail.com (10.3.7.8) X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- Note that I haven't properly tested the change in the delegate printing, because the ozlabs patchwork instance seems to barf on delegate requests. I did, however, test that the bit that I modified still works correctly. --- patchwork/bin/pwclient | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient index 8d1f476..3a8b2d1 100755 --- a/patchwork/bin/pwclient +++ b/patchwork/bin/pwclient @@ -157,7 +157,9 @@ def list_patches(patches, format_str=None): print("%-7s %-12s %s" % ("ID", "State", "Name")) print("%-7s %-12s %s" % ("--", "-----", "----")) for patch in patches: - print("%-7d %-12s %s" % (patch['id'], patch['state'], patch['name'])) + print("%-7d %-12s %s" % (patch['id'], \ + unicode(patch['state']).encode("utf-8"), \ + unicode(patch['name']).encode("utf-8"))) def action_list(rpc, filter, submitter_str, delegate_str, format_str=None): filter.resolve_ids(rpc) @@ -188,7 +190,8 @@ def action_list(rpc, filter, submitter_str, delegate_str, format_str=None): for id in ids: person = rpc.person_get(id) print "Patches delegated to %s <%s>:" % \ - (person['name'], person['email']) + (unicode(person['name']).encode("utf-8"), \ + unicode(person['email']).encode("utf-8")) f = filter f.add("delegate_id", id) patches = rpc.patch_list(f.d) @@ -204,8 +207,8 @@ def action_projects(rpc): print("%-5s %-24s %s" % ("--", "----", "-----------")) for project in projects: print("%-5d %-24s %s" % (project['id'], \ - project['linkname'], \ - project['name'])) + unicode(project['linkname']).encode("utf-8"), \ + unicode(project['name']).encode("utf-8"))) def action_states(rpc): states = rpc.state_list("", 0) @@ -264,7 +267,7 @@ def action_apply(rpc, patch_id, apply_cmd=None): print "Applying patch #%d using %s" % ( patch_id, repr(' '.join(apply_cmd))) - print "Description: %s" % patch['name'] + print "Description: %s" % unicode(patch['name']).encode("utf-8") s = rpc.patch_get_mbox(patch_id) if len(s) > 0: proc = subprocess.Popen(apply_cmd, stdin = subprocess.PIPE)