(asp.net 2.0, c#)
I have a page requesting a qyerystring looking like this ?test=b%E4st, %E4 is the url-encoded letter ÃÂ¤. I can't change how this looks and encodes since I have no access to the page doing the request.
string strTest = Request.Querystring["test"].ToString();
If I then, for instance, just Response.Write(strTest) the character ÃÂ¤ (%E4) is broken. Displayed as a question mark. I have in my web.config the requestEncoding and responseEncoding set to utf-8. That is the way I need to have it, and I can't change that.
I've looked around for a solutions for this and the issue seems to be iso-8859-1 vs utf-8 in the querystring and url-decoding. It seems the Request.Querystring automatically url-decodes the string using the default encoding, in my case utf-8. I need it to url-decode using iso-8859-1 instead. I can achieve this by altering the web.config, but as I said earlier this is not an option.
I have tried to do this:
Encoding enc = Encoding.GetEncoding(28591);
string strTest= Request.QueryString["test"];
strTest= HttpUtility.UrlDecode(strTest, enc);
Not working, since the Request.QueryString already has url-decoded the value using utf-8.
Can I somehow override the requestEncoding in the web.config? Or is the any other way of doing this?
View Complete Post