简体   繁体   中英

C# ASP convert parameters to utf8

I have a trouble with my app, one of my customers is sending me data in wrong format, so I have to decode it first to utf8.

Roteb%FCh

this "%FC" is an "ü" in ISO-8859-1

But all I get in my app is

Roteb h

and I can't encode it any more... is there a filter for controller to do this before data get converted or even url encoded?

public ActionResult Register(string adressXML)

Thanks.

The solution is to parse the post data like this:

string data = new System.IO.StreamReader(Request.InputStream).ReadToEnd();
string xmlData = System.Web.HttpUtility.UrlDecode(data, Encoding.GetEncoding("ISO-8859-1"));

then I can convert string to utf8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM