Encode URL only for unicode on Python2
changeset 73bd4ce33b84 wrongly encodes string into utf-8 instead of unicode. issue6092 review25881002
This commit is contained in:
1 parent
8344927971
commit
7d382af63d
1 file changed
+1
-1
+1
-1
@@ -22,7 +22,7 @@ class Address:
|
||||
lang = Transaction().language[:2]
|
||||
url = ' '.join(self.get_full_address('full_address').splitlines())
|
||||
if url.strip():
|
||||
if isinstance(url, str) and sys.version_info < (3,):
|
||||
if isinstance(url, unicode) and sys.version_info < (3,):
|
||||
url = url.encode('utf-8')
|
||||
return 'http://maps.google.com/maps?hl=%s&q=%s' % \
|
||||
(lang, urllib.quote(url))
|
||||
|
||||
Reference in new issue
Block a user