Re: Request.QueryString Collection Doesn't Get Umlauts
- From: "Joerg Jooss" <news-reply@xxxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 11:42:31 -0700
Axel Dahmen wrote:
> Hi,
>
> I've created an aspx page taking a query string argument as parameter.
> Although I've correctly escaped umlauts in the query string, they do
> not appear in the QueryString collection. If I give:
> http://myComp/myPage.aspx?q=G%FCnther
>
> Request.QueryString[0] yields "Gnther" instead of "Günther".
>
> What's happening?
%FC is ü in ISO-8859-1 (or -15), but ASP.NET is using UTF-8 by default
to decode request parameters (including the query string). That leaves
you with the following choices:
1. Change your application's <globalization/> element in web.config to
use ISO-8859-1 as requestEncoding (and in this case preferably
responseEncoding as well).
2. If you want to change the request encoding through code, set in it
your HttpApplication's (e.g. global.asax) Application_BeginRequest
callback:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
//This will override the <globalization/> entry with ISO-8859-1
Request.ContentEncoding = Encoding.GetEncoding(28591);
}
3. Make sure the client is using UTF-8 when encoding request
parameters. How to achieve that depends on your web client. Since
you're using a Web Form, it's most likely that the browser uses the
wrong encoding. Did you add some META tag to your Web Form, or is your
browser configured to use ISO-8859-1 exlcusively?
Cheers,
--
http://www.joergjooss.de
mailto:news-reply@xxxxxxxxxxxxx
.
- Follow-Ups:
- Re: Request.QueryString Collection Doesn't Get Umlauts
- From: Axel Dahmen
- Re: Request.QueryString Collection Doesn't Get Umlauts
- References:
- Request.QueryString Collection Doesn't Get Umlauts
- From: Axel Dahmen
- Request.QueryString Collection Doesn't Get Umlauts
- Prev by Date: errors running HttpWebRequest.GetResponse - 401 unauthorized
- Next by Date: Re: Hide Java Script
- Previous by thread: RE: Request.QueryString Collection Doesn't Get Umlauts
- Next by thread: Re: Request.QueryString Collection Doesn't Get Umlauts
- Index(es):
Relevant Pages
|