[whatwg] charset attribute of HTMLScriptElement

Toshirou Takahashi tato at fureai.or.jp
Sun May 1 22:37:52 PDT 2005


oo... sory there was no Cc: whatwg at whatwg.org
send again.

--
hi Ian :

> On Mon, 2 May 2005, Toshirou Takahashi wrote:
> > > 
> > > You can already do this -- just include the correct encoding 
> > > information in the Content-Type header for the JS file, as in:
> > > 
> > >    Content-Type: text/javascript;charset=utf-8
> > 
> > It is a good method. I also agree and I can do.
> > 
> > However, how do you do when the user cannot use cgi , .htaccess etc ?
> 
> When using systems that are unable of basic compliance with existing Web 
> standards, it is possible to include the character encoding in the "type" 
> attribute of the <script> element, as follows:
> 
>    <script type="text/javascript;charset=utf-8">
>     ...
>    </script>

I also know the method.  However, to our regret, 
I have not seen the good operation on any browser...
Charset atribute functions well of course. 


[ Test ] 
http://jsgt.org/whatwg/wa102121script/

---------------------------------------------------------------------
ToUtf8FromSjisByType.html

<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type = "text/javascript;charset=Shift_JIS"
        src  = "./sjis.js"></script>

Win
	IE6		ng
	Firefox0.8	ng
	Opera8.0	ng

---------------------------------------------------------------------
ToSjisFromUtf8ByType.html

<meta http-equiv="content-type" content="text/html; charset=Shift_JIS">
<script type = "text/javascript;charset=utf-8"
        src  = "./utf8.js"></script>

Win
	IE6		ng
	Firefox0.8	ng
	Opera8.0	ng

---------------------------------------------------------------------
ToUtf8FromSjisByCharset.html

<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script charset = "Shift_JIS"
        src     = "./sjis.js"></script>

Win
	IE6		ok
	Firefox0.8	ok
	Opera8.0	ok

---------------------------------------------------------------------
ToSjisFromUtf8ByCharset.html

<meta http-equiv="content-type" content="text/html; charset=Shift_JIS">
<script charset = "utf-8"
        src     = "./utf8.js"></script>

Win
	IE6		ok
	Firefox0.8	ok
	Opera8.0	ok


Thanx,
-- 
Toshirou Takahashi 
<http://jsgt.org/mt/01/>




More information about the whatwg mailing list