Jump to content

Help with Open URL


Recommended Posts

Posted

That depends on which programming language you're using.

In Python, it'd be one of: 

query = query.replace(' ', '-')
query = query.replace(' ', '/')
query = query.replace(' ', '%2F')
Posted

I'm trying to setup an alfred workflow to open a URL with a search query.

 

Example: 

 

1) I want to search for someone named 'John Doe'

with the following domain:

 

http://www.whitepages.com/name/John-Doe

 

How do I Encode Spaces as '-' Dashes? 

 

2) Same Scenario, but encode spaces as '/' OR '%2F'

 

http://radaris.com/p/John%2FDoe/

http://radaris.com/p/John/Doe/

 

As deanishe said, it all depends on the language that you are using. Some languages you would have to set up a manual list of character replacements. PHP has a urlencode() function that will handle a lot of the encoding for you.

Posted

Many languages have a urlencode() function, but that will only get you the / -> %2F in your examples.

Spaces will either be encoded to %20 or +, depending on options.

Posted

That depends on which programming language you're using.

In Python, it'd be one of: 

query = query.replace(' ', '-')
query = query.replace(' ', '/')
query = query.replace(' ', '%2F')

I'm not using any language at the moment, I have yet to develop any workflow. I was attempting to do it with the custom web search.

 

As far as developing a workflow is there any sample/example workflows that I can look at that might be similar to what I'm trying to accomplish?

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...