changeset 2329:f15b428852a0

jp (common): fixed encoding issue in URLs
author Goffi <goffi@goffi.org>
date Thu, 13 Jul 2017 21:45:26 +0200
parents f9adda22a2e1
children 74c1dbabeec8
files frontends/src/jp/common.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/jp/common.py	Thu Jul 13 21:23:36 2017 +0200
+++ b/frontends/src/jp/common.py	Thu Jul 13 21:45:26 2017 +0200
@@ -388,7 +388,7 @@
             # we have probably an URL, we try to parse it
             import urlparse
             url = self.args.item
-            parsed_url = urlparse.urlsplit(url)
+            parsed_url = urlparse.urlsplit(url.encode('utf-8'))
             if parsed_url.scheme.startswith('http'):
                 self.disp(u"{} URL found, trying to find associated xmpp: URI".format(parsed_url.scheme.upper()),1)
                 # HTTP URL, we try to find xmpp: links
@@ -418,14 +418,14 @@
 
                 self.disp(u"XMPP URI used: {}".format(url),2)
                 # XXX: if we have not xmpp: URI here, we'll take the data as a file path
-                pubsub_service = parsed_url.path
+                pubsub_service = parsed_url.path.decode('utf-8')
                 pubsub_data = urlparse.parse_qs(parsed_url.query)
                 try:
-                    pubsub_node = pubsub_data['node'][0]
+                    pubsub_node = pubsub_data['node'][0].decode('utf-8')
                 except KeyError:
                     self.disp(u'No node found in xmpp: URI, can\'t retrieve item', error=True)
                     self.host.quit(1)
-                pubsub_item = pubsub_data.get('item',[None])[0]
+                pubsub_item = pubsub_data.get('item',[None])[0].decode('utf-8')
                 if pubsub_item is None and self.args.last_item:
                     command = 'last'
                 elif pubsub_item is not None: