QueryString problems with "ÅÄÖ" letters

1.5k views Asked by At

I am filling a textbox with values but for some reason "ÅÄÖ" letters converts to strange characters when I use QueryString. it happens only when I use QueryStringso the problem is not in my web config.

This is how it looks like:

this.txtNewName.Text = Page.Request.QueryString["RenameSite"];

aspx:

<asp:TextBox runat="server" CssClass="rename-web-textarea" ID="txtNewName" Visible="true" MaxLength="45" />

Value should be "ärta bårta örta"

but result is: ärta bårta örta

Is there any other ways of solving this? or any way to fix it so it works with "ÅÄÖ" ?

Note! This happens only with IE8 and IE10, it works with Chrome!

The request url is this:

?RenameWebTitle=%C3%A4rta%20b%C3%A5rta%20%C3%B6rta&RenameWebUrl=http://test/site/test&IsDlg=1"

I Captured the request by the IE dev tool and Here is some detailed info:

Accept-Language: sv-SE,sv;q=0.8,en-US;q=0.5,en;q=0.3
Response headers: Content-Type: text/html; charset=utf-8

Anyone have any idea how I can solve this? Its much appreciated!

1

There are 1 answers

9
Tim Davis On

You need to encode your querystring parameters before sending them

string queryString = "RenameSite=" + encodeURIComponent("ÅÄÖ");
string url = "yoururl.com?" + queryString;