Background
I have a web application that uses ISO-8859-1
encoding. When I pass parameters using Html.ActionLink()
, the value is decoded to UTF-8
:
Web.config
:
<globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1"
fileEncoding="iso-8859-1" />
Index.aspx
This is a <%= Html.ActionLink("test", "Read", new { name="Cosméticos" }) %>
generates the following:
This is a <a href="/Intranet/Read?name=Cosm%C3%A9ticos">test</a>
The problem is the value I receive in my controller is UTF-8
, not iso-8859-1
:
TestController
:
public ActionResult Read(string name) {
//name is "Cosméticos" here!
}
Question
Why the string is not decoded to Cosméticos
?