There are 69 characters that escape does not encode: *, +, -, ., /, @, _, 0-9, az, AZ
There are 82 characters that encodeURI does not encode:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0- 9,az,AZ
encodeURIComponent does not encode 71 characters: !, ', (,), *, -, ., _, ~, 0-9, az, AZ
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.
Decoding using: unescape
C#:
HttpUtility.UrlEncode
HttpUtility.UrlDecode
2.
JS: encodeURI:
You can use encodeURI as a whole when making url jumps.
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: <script language="javascript">document.write('<a href="http://passport.baidu.com/?logout&aid=7&
u='+encodeURIComponent("http://cang.baidu.com/bruce42")+'">Exit</a& gt;');</script>
Decode using decodeURIComponent()
C#:
[HttpContext.Current.]Server.UrlDecode
[HttpContext.Current.]Server.UrlEncode