Created
February 12, 2009 17:33
-
-
Save drdrang/62753 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
-- A function for escaping URLs and skeleton code for a test. | |
on URLescape(myURL) | |
set myURL to quoted form of myURL | |
set myURL to text from character 2 to -2 of myURL | |
set cmd to " | |
from urllib import quote | |
print quote(\"" & myURL & "\", \"/:\") | |
" | |
--return cmd | |
return (do shell script "python -c '" & cmd & "'") | |
end URLescape | |
set test to "Here's a string with quotes & ampersands" | |
URLescape(test) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment