How to solve the problem of transmitting Chinese garbled between the page

xiaoxiao2021-03-06  71

How to solve the problem between the transfer of Chinese garbled, sometimes we need to transfer Chinese between the page, but .NET models are UTF-8 for our encoding format for us in WebConfig, so it is turned on when transmitting Chinese. Irregular, the corresponding acceptance will be garbled information, how to solve this problem, we can use two methods. Change the encoding method in WebConfig, as follows: 1. Change the code GB2312 "ResponseEncoding =" GB2312 "ResponseEncoding =" GB2312 "ResponseEncoding =" GB2312 "/> second method: First, encoding before passing: Example: string xm = server.urlencode (" Zhang 3 "); response.redirect (" B.ASPX? XM = " xm); then Receive page decoding: string xm = server.urldecode (RequexT.QueryString ("XM"))); there is another thing that when we make a mail system, there will be a problem with Base64, often produce garbled, I It is solved like this, try it. The code is as follows: String encodedmail = "Mail content"; Byte [] barr = convert.frombase64String (EncodedMail); string decodedmail = system.text.Encoding.Getencoding ("GB2312"). GetString (Barr); GetString (Barr);

转载请注明原文地址:https://www.9cbs.com/read-106047.html

New Post(0)