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

xiaoxiao2021-03-06  144

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

Sometimes we need to transfer Chinese between the page, but .NET models are UTF-8 for our encoding format for us in WebConfig, so the corresponding acceptance will be garbled information when transmitting Chinese. How to solve this problem, we can use two methods. Change the encoding method in WebConfig, as follows: 1. In your web.config, encoded change to 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-127348.html

New Post(0)