Directly use example: http://www.abc.php? Name = Chinese character, called by the client. garbled characters will appear after modification on the server,
Windows Phone does not support gb2312 directly. After a lot of analysis and verification, it is found that everything goes through "Conversion from Chinese characters to hexadecimal,
The Code is as follows:
String text = "Chinese character"; string url1 = "http://www.abc.php? Name = "; string url2 = url1 + utf8togb2312 (text, true ); /// <summary> /// convert Chinese characters to hexadecimal notation /// </Summary> /// <Param name = "argstrutf8"> </param> // /<Param name = "arguseparator"> whether to use % to separate Chinese characters </param> // <returns> </returns> Public static string utf8togb2312 (string argstrutf8, bool arguseseparator = true) {If (argstrutf8.length % 2 )! = 0) {argstrutf8 + = ""; // space} system. text. encoding CHS = dbcsencoding. getdbcsencoding ("gb2312"); // system. text. encoding. getencoding (charset); byte [] bytes = chs. getbytes (argstrutf8); string STR = arguseseparator? "%": ""; For (INT I = 0; I <bytes. length; I ++) {STR + = string. format ("{0: x}", bytes [I]); If (arguseseparator & (I! = Bytes. Length-1) {STR + = string. Format ("{0}", "%") ;}} return Str. toupper ();}
Http://wp.662p.com/thread-8250-1-1.html