set theURL to "http://google.com/search?q=" & (the clipboard as Unicode text)
open location theURL
(initiated manually but eventually through iKey)
Alas, it fails to work nor even give a proper error message when I run it while the clipboard contains non-ascii characters, or even punctuation marks. Firefox/Google handle all these as-is quite well.
How would I adjust the script to fire up the open location in any case?
open location "http://google.com/search?q=" & encodeURL(the clipboard)
on encodeURL(someText)
return do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(unicode(sys.argv[1], \"utf8\"))' " & quoted form of someText
end encodeURL
open location "http://google.com/search?q=" & encodeURL(the clipboard)
on encodeURL(someText)
return do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of someText
end encodeURL