Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Question mark in the middle of a URL variable

If I have a variable to pass through a URL and it has a question mark in it, do I just need to escape the question mark?

If not, how can I make sure it passes through like it's supposed to?

like image 849
townie Avatar asked Feb 20 '12 06:02

townie


People also ask

What does it mean when a URL has a question mark?

What Does a Question Mark in URL Do? URLs have query strings that specify parameters through a group of characters typed into a browser to retrieve information. A question mark is not a part of the query string, but it's used to establish boundaries and is considered a separator.

Can a URL have question mark?

In a URL, the query starts with a question mark - the question mark is used as a separator, and is not part of the query string. If you also include a question mark in the query string, this would be treated as a literal question mark (i.e. it has no significance beyond that of a regular character).

What does question mark after variable mean?

The question mark after the variable is called Optional chaining (?.) in JavaScript. The optional chaining operator provides a way to simplify accessing values through connected objects when it's possible that a reference or function may be undefined or null.

How do you escape a question mark?

Use a backslash character \ to escape the question mark.


1 Answers

A question mark URL encodes as %3F. But you should use a proper encoder for the whole thing rather than manually encoding a character.

like image 59
David Schwartz Avatar answered Sep 30 '22 02:09

David Schwartz