]> git.ozlabs.org Git - patchwork/commitdiff
pwclient: fix handling of UTF-8 char in submitter name
authorAndreas Bießmann <andreas.devel@googlemail.com>
Tue, 7 Dec 2010 15:48:20 +0000 (16:48 +0100)
committerJeremy Kerr <jk@ozlabs.org>
Fri, 10 Dec 2010 04:28:11 +0000 (12:28 +0800)
This patch fixes following bug in 'list':

---8<---
# pwclient list -p uboot -w andreas.devel | grep New
Traceback (most recent call last):
  File "/Users/andreas/bin/pwclient", line 463, in <module>
    main()
  File "/Users/andreas/bin/pwclient", line 411, in main
    action_list(rpc, filt, submitter_str, delegate_str)
  File "/Users/andreas/bin/pwclient", line 182, in action_list
    (person['name'], person['email'])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xdf' in
position 32: ordinal not in range(128)
--->8---

Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/bin/pwclient

index dc836e918121fdac782e2111987817ecf33d2d93..dba68fb036b1b28c9351548f6cf142b770238ccb 100755 (executable)
@@ -179,7 +179,8 @@ def action_list(rpc, filter, submitter_str, delegate_str):
             for id in ids:
                 person = rpc.person_get(id)
                 print "Patches submitted by %s <%s>:" % \
-                        (person['name'], person['email'])
+                        (unicode(person['name']).encode("utf-8"), \
+                         unicode(person['email']).encode("utf-8"))
                 f = filter
                 f.add("submitter_id", id)
                 patches = rpc.patch_list(f.d)