Recently, I found the data lost when I passed the special character with the URL.
In fact, it is not lost, for example, ' + ' it will be treated as a connection character.
One, replace into 16 characters, in this column several commonly used conversions
| + |
Space |
/ |
? |
% |
& |
= |
# |
| %2b |
%20 |
%2f |
%3f |
%25 |
%26 |
&3d |
%23 |
Copy Code code as follows:
var post_str = Apply_name.replace (/\+/g, "%2b");//"+" escape
var post_str= post_str.replace (/\&/g, "%26");//"&"
var post_str= post_str.replace (/\#/g, "%23");/"#"
Second, if you encounter other special characters, you can use the following method to see what it turned into, directly follow the above method to write a line
Copy Code code as follows:
Alert (encodeURIComponent ("-)")//transcoding, get the result is OK, the bottom is decoding, here is not used
Alert (decodeURIComponent ("#")) (encodeURIComponent);