6

As explained in the title, whatever I do, I can't get webbrowser to open the URL I want it to open.

I tried escaping the double quotes with \

I tried using %22 in the URL instead of "

No matter what, the end URL ends up effectively turning " into %2522

I know that %25 represents %, which means, somehow " is being turned into %22 first and then the % in that is being turned into %25. Makes no sense, I don't know why it would get processed twice anyway.

Example URL (what I get when I print the variable in python):

https://domain.com/do?q=item:(("abc")+OR+("def")+OR+("ghj"))

What webbrowser opens in Chrome:

https://domain.com/do?q=item:((%2522abc%2522)+OR+(%2522def%2522)+OR+(%2522ghj%2522))

leet
  • 118
  • 1
  • 7

1 Answers1

7

Your code is URL encoding twice. %2522 is a double encoding of " as the encoding of % is %25.

> decodeURIComponent('%2522')
"%22"
> decodeURIComponent('%22')
"\""
Dan D.
  • 73,243
  • 15
  • 104
  • 123
  • The thing is I'm not processing the URL at all. It comes straight from a list and gets appended a string. `urls = appscript.app('Google Chrome').windows.tabs.URL() fresh = [item for sublist in urls for item in sublist]` – leet Aug 07 '15 at 03:09