Mercurial > libervia-backend
comparison src/tools/common/uri.py @ 2328:f9adda22a2e1
tools(common/uri): fixed encoding in buildXMPPUri
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 13 Jul 2017 21:23:36 +0200 |
parents | 91a14dab924d |
children | 8b37a62336c3 |
comparison
equal
deleted
inserted
replaced
2327:dad500e7ae50 | 2328:f9adda22a2e1 |
---|---|
73 | 73 |
74 return data | 74 return data |
75 | 75 |
76 def addPairs(uri, pairs): | 76 def addPairs(uri, pairs): |
77 for k,v in pairs.iteritems(): | 77 for k,v in pairs.iteritems(): |
78 uri.append(u';' + urllib.quote_plus(k) + u'=' + urllib.quote_plus(v)) | 78 uri.append(u';' + urllib.quote_plus(k.encode('utf-8')) + u'=' + urllib.quote_plus(v.encode('utf-8'))) |
79 | 79 |
80 def buildXMPPUri(type_, **kwargs): | 80 def buildXMPPUri(type_, **kwargs): |
81 uri = [u'xmpp:'] | 81 uri = [u'xmpp:'] |
82 subtype = kwargs.pop('subtype', None) | 82 subtype = kwargs.pop('subtype', None) |
83 path = kwargs.pop('path') | 83 path = kwargs.pop('path') |
84 uri.append(urllib.quote_plus(path).replace(u'%40', '@')) | 84 uri.append(urllib.quote_plus(path.encode('utf-8')).replace(u'%40', '@')) |
85 | 85 |
86 if type_ == u'pubsub': | 86 if type_ == u'pubsub': |
87 if subtype == 'microblog' and not kwargs.get('node'): | 87 if subtype == 'microblog' and not kwargs.get('node'): |
88 kwargs[u'node'] = 'urn:xmpp:microblog:0' | 88 kwargs[u'node'] = 'urn:xmpp:microblog:0' |
89 if kwargs: | 89 if kwargs: |