When I insert this URL in the browser's address field:
https://www.google.com/search?q=notepad++.exe
then the plus characters are replaced by space characters in the Google search field:
How can this bug be avoided?
When I insert this URL in the browser's address field:
https://www.google.com/search?q=notepad++.exe
then the plus characters are replaced by space characters in the Google search field:
How can this bug be avoided?
This isn't a bug - when encoding URLs, the character set becomes more limited, meaning that there needs to be a way to represent the full character set that is now unavailable.
+
) is used to mark a space - you will also see a space encoded as %20
.?
) is often used to separate the resource path and the query string.%
) is used to initiate the escape sequence.If you want to make use of a literal +
then you must escape it, using the standard %xx
sequence, and providing the hex value for the character.
In this case, you want to represent a +
, the ASCII value for which is 43
decimal, or 0x2B
hexadecimal.
%2B
in place of the +
.Similarly if you want to represent a literal %
, then you must "escape" it, because it is used to initiate the escape sequence... you must use %25
in place of a %
.
Research "URL Encoding" to find out more
Try entering notepad++.exe
into the box on this page: HTML URL Encoding Reference.
You have to escape the '+'
fixed URL: https://www.google.de/search?q=notepad%2B%2B.exe
Some characters arent supported or have a specific purpose in URLs thus you cant just put them in where ever you want. You can get around that problem by escaping them like this:
%[insert hexadecimal representation of the character]
How can this bug be avoided?
It actually isn't a bug.
However, you can use notepad%2B%2B++.exe
, instead to get around the intentional behavior.