Jump to content

Need a little help to turn {query} to url encode character


Recommended Posts

I am having a little trouble to convert {query} to url encode characters, I found a solution from Stack Exchange

https://askubuntu.com/questions/53770/how-can-i-encode-and-decode-percent-encoded-strings-on-the-command-line

 

It works fine in the terminal

alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
echo "test special character +-*/=" | urlencode

but when I edit and paste to "script" in Alfred workflow it fail to run

alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
echo "{query}" | urlencode

The input node is "hotkey", "current selection from os" Thanks :)

Screen Shot 2016-11-09 at 8.30.14 PM.png

Edited by dunkaroo
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...