Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Urllib quote strange behaviour
(Pdb) result
u'/ci-test-site/Shared Documents/v2/no such+\u2603'
(Pdb) urllib.quote(result.encode('utf-8'), safe=b'/+')
*** UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)
(Pdb) urllib.quote(result.encode('utf-8'), safe=b'+/')
'/ci-test-site/Shared%20Documents/v2/no%20such+%E2%98%83'
(Pdb) urllib.quote(result.encode('utf-8'), safe=b'/')
'/ci-test-site/Shared%20Documents/v2/no%20such%2B%E2%98%83'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.