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

xiaoxiao2021-03-06  106

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:

Method 1: Code in your web.config

change to

Method 2: First encode first before delivery: String XM = Server.urlencode ("Zhang 3"); response.redirect ("B.ASPX? XM =" xm); then receive page decoding: string xm = Server.urdecode ("XM")); there is another thing that there will be a problem that receives Base64 when we make an email system, often producing garbled, I solved this, may wish Try. code show as below:

String encodedmail = "Mail content"; Byte [] barr = convert.FromBase64String (encodedmail); string decodedmail = system.text.Encoding.Getencoding ("GB2312"). GetString (Barr);

Some small problems that the author experienced itself, you may wish to let everyone see, and you.

Because the author is limited, the code is omissions, please point out, the code is chaotic, please forgive me!

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

New Post(0)