[whatwg] <script charset="">

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.

Well..

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

http://www.w3.org/TR/REC-html40/charset.html#h-5.2.2

Priorities

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
resource. 

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>
<body>
...

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
side.

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.

Thanx.

> 
> -- 
> 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>
?????
http://allabout.co.jp/internet/javascript/profile/mbiopage.htm
http://jsgt.org/mt/01/

Received on Thursday, 15 May 2008 06:05:18 UTC