Js pass parameter affected by special characters error solution
- 2020-03-26 21:35:33
- OfStack
Similar to ` ~! @ # $% ^ & * () _ - = [] {} |; ': "\ / < > ? Such special characters as parameters, if not processed, will be passed to the product parameter error.
Solutions:
EncodeURI method
Encodes the text string as a valid uniform resource identifier (URI).
EncodeURI (URIString)
The required URIString parameter represents an encoded URI.
instructions
The encodeURI method returns an encoded URI. If you pass the encoding result to the decodeURI, the original string is returned. The encodeURI method does not encode the following characters :" :", "/", ";" And "?" . Use the encodeURIComponent method to encode these characters.
Solutions:
EncodeURI method
Encodes the text string as a valid uniform resource identifier (URI).
EncodeURI (URIString)
The required URIString parameter represents an encoded URI.
instructions
The encodeURI method returns an encoded URI. If you pass the encoding result to the decodeURI, the original string is returned. The encodeURI method does not encode the following characters :" :", "/", ";" And "?" . Use the encodeURIComponent method to encode these characters.