Created
October 11, 2017 16:40
-
-
Save adiroiban/9334396160f8287cad3e1141a50d3ac7 to your computer and use it in GitHub Desktop.
Urllib quote strange behaviour
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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