How can I include special characters in query strings?
You have to encode special characters in URLs. See: http://www.w3schools.com/tags/ref_urlencode.asp
How can I consider special character(&) as value in one of the query parameter
Your query parameters should be URL-encoded in order to differenciate a separating &
from a random character.
The solution is to encode the value before sending it through the request. You can do so by passing your value to encodeURIComponent()
. You can then parse it the same way and decode it using decodeURIComponent()
, e. g. :
encodeURIComponent('my&title') -> 'my%26title'
decodeURIComponent('my%26title') -> 'my&title'
How to read query param value if special character (&) part of query param value
If the & character is part of the name or value in the query string then it has to be percent encoded. In the given example: contentName=abc%26def&path=Test&type=folder
.
Handling special characters in query string
the # is not included, it's just an indicator for repleaceable content.
Faced a similar mistake with mongodb connect api, when they used to have # in their connection strings.
you can't have an # in the name of a variable/query string, it's just an indicator.
in third party api now, they use <> to mean replaceable content/values
like <access_token=something> or <access_token>.
Query strings with special characters
Use Server.UrlEncode
:
URLEncode converts characters as follows:
Spaces ( ) are converted to plus signs (+).
Non-alphanumeric characters are escaped to their hexadecimal representation.
Use it this way;
<a href="page2.asp?name=<%= Server.URLEncode(sName) %>">here</a>
Related Topics
How to Create a Triangle in CSS3 Using Border-Radius
How to Show Three Columns Per Row
What Is The Correct Use of Schema.Org Sitenavigationelement
Browser Canvas Cors Support for Cross Domain Loaded Image Manipulation
How to Insert HTML Content in Xml Document
Responsive Tables, The Smart Way
How to Show an Animation That Is Hidden Behind a Colored Div Using a "Reveal" Div on The Surface
@Font-Face Not Working with Specific Version of Internet Explorer 11
Safari Anchors on Links Not Working
How to Get a Textarea to Stretch to Fit Its Content Without Using PHP or JavaScript
Responsive Web Design Tips, Best Practices and Dynamic Image Scaling Techniques
Achieving Sub Numbering on Ol Items HTML
Fallback Background-Image If Default Doesn't Exist
Alternate Background Colors for List Items
How to Wrap Text Around a Non Rectangular Image
Why Isn't Position:Sticky with Left:0 Working Inside a Scrollable Container