Some characters cannot be part of a URL (for example, the space) and some other characters have a special meaning in a URL: for example, the character
# can be used to further specify a subsection (or fragment) of a document; the character
= is used to separate a name from a value. A query string may need to be converted to satisfy these constraints. This can be done using a schema known as URL encoding.
In particular, encoding the query string uses the following rules:
The octet corresponding to the tilde ("~") character is often encoded as "%7E" by older URI processing implementations; the "%7E" can be replaced by"~" without changing its interpretation. Source [Wikipedia]