C# ?? UrlEncode
???????????????(Percent-Encoding),??? URL ?????????????????????????,????????????????????????:
- ????(ASCII 32)??????(+)?
- ???(")???????(")?
- ??(#)??????(#)?
- ???(%)???????(%)?
- ??(&)??????(&)?
- ??(+)??????(+)?
- ??(/)??????(/)?
- ??(:)??????(:)?
- ??(;)??????(;)?
- ???(<)???????(<)?
- ???(=)???????(=)?
- ???(>)???????(>)?
- ??(?)??????(?)?
- "@" ?????? "@"(@)?
- "A-Z" ? "a-z" ??????????????? ASCII ?,????
%
?????,???? "A" ????A
,???? "b" ????b
? - "0-9" ??????????????? ASCII ?,????
%
?????,?? "5" ????5
? - ????(??????? ASCII ???)?????????? Unicode ?,????
%
?????,????????
? C# ?,????? System.Net.WebUtility.UrlEncode
???????? URL ?????:
string url = "https://www.example.com/???param=??&anotherParam=??"; string encodedUrl = System.Net.WebUtility.UrlEncode(url); Console.WriteLine(encodedUrl);
??????:
https://www.example.com/测试?param=你好&anotherParam=世界