]> git.ozlabs.org Git - patchwork/commitdiff
pwclient fix for handling messages with UTF-8
authorMauro Carvalho Chehab <mchehab@infradead.org>
Tue, 17 Feb 2009 10:34:51 +0000 (07:34 -0300)
committerJeremy Kerr <jk@ozlabs.org>
Fri, 18 Sep 2009 02:00:32 +0000 (10:00 +0800)
pwclient works fine viewing utf-8 messages, if you don't try to redirect stdout.

However, if you do things like pwclient view 5063 >/tmp/patch, it fails
due to the weird character handling logic in python:

Traceback (most recent call last):
  File "/usr/local/bin/pwclient", line 446, in ?
    main()
  File "/usr/local/bin/pwclient", line 411, in main
    print s
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 249: ordinal not in range(128)

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/bin/pwclient

index e25212a8a4088c4def4f608071e971c63db997e9..6a1a36acc089e480778ec10104f1e084fafe5b94 100755 (executable)
@@ -408,7 +408,7 @@ def main():
 
         s = rpc.patch_get_mbox(patch_id)
         if len(s) > 0:
-            print s
+            print unicode(s).encode("utf-8")
 
     elif action == 'get' or action == 'save':
         try: