I'm facing the problem with the URL encoding when sending the search request with the query.
My query accepts the UTF-8 characters from the input form element.
But the value encoded is very different if I try with the encodeURIComponent.
Eg:
Could someone explain?
The encodeURIComponent() function encodes a URI by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two "surrogate" characters).
In other words, it replaces special characters with certain characters that can be used in the URL.
So you need to decode the encoded URI from the server-side.
Node.js:
decodeURI();
PHP:
urldecode();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.