There are 69 characters that are not encoded by escape: *, ,-,.,/,@,_,0-9,a-z,A-Z
encodeURI has 82 non-encoded characters: !, #, $, &, ', (,), *, ,,, -,.,/,:,;,=,?,@,_,~, 0-9, a-z, A-Z
encodeURIComponent has 71 unencoded characters: !, ', (,), *, -, ., _, ~, 0-9, a-z, A-Z
1.
JS: escape :
You can use escape when using data in js
For example: history record in collection.
When encoding unicode values other than 0-255, the %u**** format is output. In other cases, the encoding results of escape, encodeURI, and encodeURIComponent are the same.
Decode using: unescape
C#:
HttpUtility.UrlEncode
HttpUtility.UrlDecode
2.
JS: encodeURI:
You can use encodeURI as a whole when performing url jump
For example: Location.href=encodeURI("http://cang.baidu.com/do/s?word=Baidu&ct=21");
Decode using decodeURI();
C#: decodeURIComponent
3.
JS: encodeURIComponent:
You need to use encodeURIComponent when passing parameters, so that the combined url will not be truncated by special characters such as #.
For example:
Decode using decodeURIComponent()
C#:
[HttpContext.Current.]Server.UrlDecode
[HttpContext.Current.]Server.UrlEncode