0

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:

enter image description here

How can this bug be avoided?

1
  • 1
    Special character Encoding in URLs is not a bug at all !
    – C0deDaedalus
    Commented May 5, 2018 at 15:45

3 Answers 3

7

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


Research "URL Encoding" to find out more

Try entering notepad++.exe into the box on this page: HTML URL Encoding Reference.

0
1

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]

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.