Re: Encoding in ASP.NET sites
- From: Joerg Jooss <news-reply@xxxxxxxxxxxxx>
- Date: Wed, 29 Mar 2006 20:39:23 +0000 (UTC)
Thus wrote PL,
If you enter text directly onto the pages in UTF-8 then your pages
must be saved in UTF-8,
Yes and...
and you must specify the charset in the header
such as:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
No, you don't have to. The response encoding is set as charset attribute as part of the Content-Type HTTP header, which overrules META tags in every civilized browser in use (YMMV).
META tags are also completely useless for true multibyte encodings like UTF-16, at least as far as IE and Mozilla are concerned.
Although you don't necessarily have to save your scripts as UTF-8 to
display UTF-8, if you have unicode text being pulled from a database
then alll you need is to specify the default encoding for your app
which is usually already set to utf-8, you should also specify
CODEPAGE="65001" in your @ Page declaration as well as provide the
Content-Type meta tag so browsers know what encoding the page is in.
There's also the ResponseEncoding attribute, which uses friendly IANA names instead of Win32 codepage identifiers. And of course there's the ContentEncoding property in HttpResponse to set the encoding through code.
But all of this isn't required, *if* requestEncoding and responseEncoding are set to UTF-8 in web.config, which is the default.
Cheers,
--
Joerg Jooss
news-reply@xxxxxxxxxxxxx
.
- Follow-Ups:
- Re: Encoding in ASP.NET sites
- From: PL
- Re: Encoding in ASP.NET sites
- References:
- Re: Encoding in ASP.NET sites
- From: PL
- Re: Encoding in ASP.NET sites
- Prev by Date: error Login failed. Details: crdb_adoplus
- Next by Date: Re: Encoding in ASP.NET sites
- Previous by thread: Re: Encoding in ASP.NET sites
- Next by thread: Re: Encoding in ASP.NET sites
- Index(es):
Relevant Pages
|