[whatwg] <script charset="">

Toshiro Takahashi tato at game.gr.jp
Thu May 15 06:05:18 PDT 2008

On Wed, 14 May 2008 01:46:32 +0000 (UTC)
Ian Hickson <ian at hixie.ch>さん wrote:

> On Mon, 25 Apr 2005, Toshirou Takahashi wrote:
> > 
> > about 2.12. Scripting
> > 
> > http://whatwg.org/specs/web-apps/current-work/#the-script
> > interface HTMLScriptElement : HTMLElement {
> >            attribute DOMString text;
> >            attribute DOMString src;
> >            attribute DOMString type;
> > };
> > 
> > 
> > Why isn't there Charset attribute ?
> I've added it.
> I haven't tested where UAs get their charset="" information from in 
> detail. The spec, as defined now, makes the charset="" attribute 
> authoritative, and if the attribute is omitted, makes document.charset the 
> required authoritative default. Is that what browsers do?

I can write English a little. If there is a mistake, I am sorry.


I do not know it, But, I think that probably is so.



1.An HTTP "charset" parameter in a "Content-Type" field. 
2.A META declaration with "http-equiv" set to "Content-Type" and a value
set for "charset". 
3.The charset attribute set on an element that designates an external

The user agent may use heuristics and user settings.

But,The page becomes the storm of the error, if a browser ignores the
attribute that a person knowing charset of the js file appointed.

The Charset attribute evades an error surely on all current browsers.

In Japan, There are a lot of data assets of character codes such as Shift_JIS, EUC
, ISO-2022-JP, UTF-8 ... 

And it is not rare that they coexist on one page.

For example

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script src="./hogelib.js" charset="Shift_JIS"></script>
<script src="./hogeJson.js" charset="EUC-JP"></script>

It cannot solve an error by the setting of the browser by the user. 
The reason is because an error is already taking place when user open up
a page.
And there are a lot of cases which cannot set Content-Type in the server

By the way, I think that @charset "Shift_JIS"; in JS code (like CSS) is
good, but think the charset attribute to be the realistic choice that
all current browsers can avoid an error and confusion.


> -- 
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Toshiro Takahashi <tato at game.gr.jp>

More information about the whatwg mailing list