vladaruz
vladaruz

Reputation: 229

CSS character encoding @charset

What is the difference between charset name set lowercase or uppercase. Or it should be all CAPS?

@charset "UTF-8"; or @charset "utf-8";

Upvotes: 4

Views: 1835

Answers (2)

lavinio
lavinio

Reputation: 24329

There is no difference in practical terms. According to the IANA:

The character set names may be up to 40 characters taken from the printable characters of US-ASCII. However, no distinction is made between use of upper and lower case letters.

Each encoding has a canonical name, which is the official name.

The complete official list of IANA-assigned names and aliases is here.

For example:

  • the official name of UTF-8 is UTF-8
  • the official name of US-ASCII is actually ANSI_X3.4-1968, but these are all proper aliases: US-ASCII, iso-ir-6, ANSI_X3.4-1986, ISO_646.irv:1991, ASCII, ISO646-US, us, IBM367, cp367, csASCII
  • the official name of latin8 is ISO-8859-14, with aliases latin8, iso-ir-199, ISO_8859-14:1998, ISO_8859-14, iso-celtic, l8

Not all implementations support the full set of IATA encodings and alias names; so you might want to test carefully if you're going to use something that isn't mainstream.

Upvotes: 6

Nick Presta
Nick Presta

Reputation: 28705

http://www.w3.org/International/questions/qa-css-charset

In your example, it should be UTF-8 (uppercase), but it doesn't have to be all uppercase. latin8, for example, is lowercase.

Upvotes: 0

Related Questions