Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webbrowser converts double quotes to %2522

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

like image 584
leet Avatar asked Aug 06 '15 23:08

leet


1 Answers

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

> decodeURIComponent('%2522')
"%22"
> decodeURIComponent('%22')
"\""
like image 85
Dan D. Avatar answered Nov 12 '22 12:11

Dan D.