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?
Best Answer
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.
A plus (+) is used to mark a space - you will also see a space encoded as %20.
A question mark (?) is often used to separate the resource path and the query string.
A percent sign (%) 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.
This means that you need to use %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 %.
The catch? You need to search for at least two or three characters.
Now for queries containing sequences of 2-3 special characters such as [== vs ===] and [+=], Google will return results on the meaning of these sequences in programming languages.
For example, if you’re searching for the meaning of [c++17], you will get results for the well-known programming language instead of c17, which brings up a Boeing airplane. Additionally, organization and product names that include punctuation, such as She++ and Notepad++, will return more accurate results.
+= is even called out specifically as an example string.
As with all Google improvements, this is likely rolling out in stages, and may not be available in all languages.
Apparently having your Referer set to *.google.com also works. The links in this post of mine on the Google Product forums all work as long because the referer being sent with the request.
Best Answer
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 is43
decimal, or0x2B
hexadecimal.This means that you need to use
%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.