charset (HTML attribute)
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
| IE | 5.5 | None |
|---|---|---|
| 6.0 | None | |
| 7.0 | None | |
| Firefox | 1.0 | None |
| 1.5 | None | |
| 2.0 | None | |
| Safari | 1.3 | None |
| 2.0 | None | |
| 3.0 | None | |
| Opera | 9.2 | None |
| 9.5 | None |
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
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.

