0

I have a MVC 2 application. <globalization requestEncoding="utf-8" responseEncoding="utf-8"/> is added in web.config and <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> in master page. But the Non-ASCII characters still can not be encoded and decoded correctly.

For example, "Mayagüez" is displayed in an action, but after passed through a url, it is displayed as "Mayag�ez".

If I try to use HttpUtility.HtmlEncode for "Mayagüez", the string is truncated as "Mayag" after processed through HttpUtility.HtmlDecode.

Don
  • 1,532
  • 4
  • 24
  • 47

1 Answers1

0

Just figured out that using Url.Encode instead of HttpUtility.HtmlEncode can make it work.

Don
  • 1,532
  • 4
  • 24
  • 47