The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Default Encoding for ASP.NET ???

0 replies.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a flat view of this topic  Flat View
Previous Topic   Next Topic
Threaded View: This topic has 0 replies on 1 page
Sudhakar Sadasivuni

Posts: 418
Nickname: sadasivuni
Registered: Nov, 2003

Sudhakar Sadasivuni is a Microsoft .NET MVP, a project engineer for Wipro technologies.
Default Encoding for ASP.NET ??? Posted: Jan 19, 2005 10:39 AM
Reply to this message Reply

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;
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Sudhakar Sadasivuni
Latest Posts From {Sudhakar's .NET Dump Yard;}

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.

<configuration>
   <system.web>
      <globalization
         requestEncoding="utf-8"
         responseEncoding="utf-8" />
   </system.web>
</configuration>

You can find more on this section here

Read: Default Encoding for ASP.NET ???


Topic: Wanted: Great questions for an interview with Juval Lowy Previous Topic   Next Topic Topic: I'll be available for consulting in the bay area

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use