C#中將中文字符轉換成url編碼


1 Encoding gb2312 = Encoding.GetEncoding("gb2312");
2 Encoding utf8 = Encoding.UTF8;
3 //首先用utf-8進行解碼
4 string key = HttpUtility.UrlDecode(oStr, utf8);
5 // 將已經解碼的字符再次進行編碼.
6 string encode = HttpUtility.UrlEncode(key, utf8).ToLower();

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM