måndag 19 maj 2008

ASP.NET Ajax and the need of UTF-8 encoding

When using ASP.NET Ajax and non standard characters in the page title (such as the swedish "ö"), the Ajax framework might stop working complaining about illegal use of "Response.Write, Response.Filter etc".

The problem has actually nothing to do with this but is related to the character encoding set in web.config. To make Ajax work with special characters the encoding of the "globalization"-element must be set to "UTF-8" in web.config.

The reasons is that the server will return a non legal coding for the special character which will mess up the javascript code in Ajax on the client side.

This is actually a quite old and commonly known issue, but personally I had totally forgot about it since it was a long time I read about it...

Inga kommentarer: