charset (HTML attribute)
| Depr. | Version |
|---|---|
| No | HTML 4 |
| IE7 | FF2 | SA3 | OP9.5 |
|---|---|---|---|
| None | None | None | None |
Syntax
Description
The
charset attribute is intended to identify the
character set used in the document that’s referenced within the
link element.
Example
This example indicates that the referenced document is written in Japanese:
<link href="okinawa.html" rel="parent" charset="euc-jp"/>
Value
The value taken by
charset is a standard character set encoding name (e.g.
"UTF-8") defined by IANA.
Compatibility
| Internet Explorer | Firefox | Safari | Opera | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 5.5 | 6.0 | 7.0 | 1.0 | 1.5 | 2.0 | 1.3 | 2.0 | 3.0 | 9.2 | 9.5 |
| None | None | None | None | None | None | None | None | None | None | None |
None of the browsers tested appeared to do anything to notify the user that the referenced document would be presented in any special (or different) character encoding.
In essence, charset is a totally
useless attribute that fails to do anything practical. Its implementation
has been unsuccessful in all browsers, so 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.