This post originated from an RSS feed registered with .NET Buzz
by Sudhakar Sadasivuni.
Original Post: Default Encoding for ASP.NET ???
Feed Title: {Sudhakar's .NET Dump Yard;}
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/ssadasivuni/rss.aspx
Feed Description: using Sudhakar.Dotnet.Blog.Main;
What is the default encoding used by ASP.NET ? Very trivial question huh ;-)
I found this as one of the most ignored thing in Web Application developement using ASP.NET by any developer. Since VS.NET does a smart job by setting up a default encoding in web application configuration, they need to bother about it....until unless they get a problem with 'characters' display somewhere.
Today one of my buddy has got one weird problem with Japanese characters display while exporting the reports to excel. It means somewhere the encoding set by VS.NET at application level was overriden explicitly and Response was formed with the overriden encoding to the stream.
I tried to dig more in to this and found some interesting stuff here and here
ASP.NET's default encoding will be "iso-8859-1" (Western Europe) for both Response and Request. i.e.. If Response/Request encoding is not specified in a machine.config or web.config file, encoding defaults to the machine's Regional Options >> locale setting.
But Visual Studio.NET creates a section called <Globalization> and creates a default value "utf-8" to override the actual response/request encoding defaults. This makes our life happy enough to ignore the crux of encoding for our application.