In general, the parameters in the URL should use the URL encoding rule, which is to put the parameter string in addition to-_. All non-alphanumeric characters are replaced with a percent sign (%) followed by a two-digit hexadecimal number, and a space is encoded as a plus (+). But for parameters with Chinese, this encoding causes the encoded string to become very long. If you want to encode the parameter in a shorter way, you can encode the string in base64 encoding, but the Base64 encoding cannot handle the Chinese in JavaScript, because the Chinese in JavaScript is saved in UTF-16 manner. Base64 can only handle single-byte characters, so it is not possible to encode JavaScript strings with Chinese in base64 directly. However, it is possible to convert UTF-16 encoded Chinese into UTF-8 mode by utf.js the UTF16TO8 provided in this program, and then Base64 encode. This encoded string, after being passed to the server side, can be decoded into the UTF-8 string directly via Base64_decode. But there is one more question to keep in mind. The plus sign (+) is used in the Base64 encoding, and the + is treated as a space when the URL is passed, so you must replace the plus sign in the Base64 encoded string with%2B to be passed as a URL parameter. Otherwise, errors will occur after the server-side decoding.
So what we need to do is encodeURI (str). replace (/\+/g, '%2b ')
Turn: Technology Achievement Dream
How to handle the plus sign (+) in the js pass parameter