Document Encoding/Charset

Document Encoding/Charset

am 21.06.2007 18:15:31 von pietromas

Im confused by these two lines that I include in my html:


....


Can I choose any encodings I want here or is the correct choice
related to how my editor saves my files? Does using UTF-8 offer a
portability advantage over the other encodings? How to choose?

Re: Document Encoding/Charset

am 21.06.2007 18:19:51 von dorward

On Jun 21, 5:15 pm, Pietro wrote:
> Im confused by these two lines that I include in my html:

>

You should not be including this line in XHTML served as text/html
(see Appendix C of the XHTML 1.0 spec). (For that matter, XHTML is
generally a poor idea on the WWW). If you aren't using XHTML then you
shouldn't be using it either.

>

And if you are using XHTML then you're missing a slash.

> Can I choose any encodings I want here or is the correct choice
> related to how my editor saves my files?

You need to specify the encoding the document is saved in. A good
editor will let you choose. Note that real HTTP headers trump any
claim in the document and that they are the correct place to tell the
client what encoding you are using.

> Does using UTF-8 offer a portability advantage over the other encodings?

It can encode pretty much any character you are likely to need, and
does have wide support.

> How to choose?

If in doubt, UTF-8.

--
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/

Re: Document Encoding/Charset

am 21.06.2007 19:33:55 von Harlan Messinger

David Dorward wrote:
> On Jun 21, 5:15 pm, Pietro wrote:
>> Im confused by these two lines that I include in my html:
>
>>
>
> You should not be including this line in XHTML served as text/html
> (see Appendix C of the XHTML 1.0 spec). (For that matter, XHTML is
> generally a poor idea on the WWW). If you aren't using XHTML then you
> shouldn't be using it either.
>
>>
>
> And if you are using XHTML then you're missing a slash.
>
>> Can I choose any encodings I want here or is the correct choice
>> related to how my editor saves my files?
>
> You need to specify the encoding the document is saved in.

More precisely, the encoding in which the document is transmitted to the
client, though ordinarily I guess that would be the same as the encoding
in which it's saved.

> A good
> editor will let you choose. Note that real HTTP headers trump any
> claim in the document and that they are the correct place to tell the
> client what encoding you are using.
>
>> Does using UTF-8 offer a portability advantage over the other encodings?
>
> It can encode pretty much any character you are likely to need, and
> does have wide support.
>
>> How to choose?
>
> If in doubt, UTF-8.