Skip to: content, navigation

by Ian Lloyd

charset (HTML attribute)

Browser support full matrix
IE7 FF2 Saf3 Op9.5
None None None None
Spec
Depr. Version
No HTML 4
charset="character encoding scheme"

Example

The referenced document is indicated to be Japanese:

<link href="okinawa.html" rel="parent" charset="euc-jp" />

Description

The charset attribute is intended to identify the character set used in the document referenced in the link element.

Value

A standard character set encoding name (e.g. "UTF-8"), as defined by IANA (http://www.iana.org/assignments/character-sets).

Compatibility

IE5.5None
6.0None
7.0None
Firefox1.0None
1.5None
2.0None
Safari1.3None
2.0None
3.0None
Opera9.2None
9.5None

None of the browsers tested appeared to do anything by way of notifying the user that the referenced document would be presented in any special (or different) character encoding.

This is, in essence, a totally useless attribute that fails to do anything practical, and is extremely broken by design and therefore its use should be avoided entirely.

User-contributed notes

ID:
#1
Date:
Wed, 12 Mar 2008 09:01:25 GMT
Contributed by:
AutisticCuckoo

At least Firefox and Opera do honour this attribute, which can be evidenced if you use generated content. If the external style sheet uses a different character encoding than the document that links to it (and the server doesn't send encoding information in the Content-Type header), the generated content will be gibberish if it contains characters outside the US-ASCII repertoire. Adding a CHARSET attribute to the LINK element fixes the problem in FF2.0 and Opera 9.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters