HTML Standard Tracker


File a bug

SVNBugCommentTime (UTC)
2697Define handling of MIME type charsets in <script src> external scripts2009-01-23 10:19
@@ -10236,29 +10236,26 @@ people expect to have work and what is necessary.
   URL</span> identifying a script resource of the type given by the
   <code title="attr-script-type">type</code> attribute, if the
   attribute is present, or of the type "<code
   title="">text/javascript</code>", if the attribute is absent.</p>
   <p>The <dfn title="attr-script-charset"><code>charset</code></dfn>
   attribute gives the character encoding of the external script
   resource. The attribute must not be specified if the <code
   title="attr-script-src">src</code> attribute is not present. If the
   attribute is set, its value must be a valid character encoding name,
-  and must be the preferred name for that encoding. <a
+  must be the preferred name for that encoding, and must match the
+  encoding given in the <code title="">charset</code> parameter of the
+  <span title="Content-Type">Content-Type metadata</span> of the
+  external file, if any. <a
-  <p>The encoding specified must be the encoding used by the script
-  resource. If the <code title="attr-script-charset">charset</code>
-  attribute is omitted, the character encoding of the document will be
-  used. If the script resource uses a different encoding than the
-  document, then the attribute must be specified.</p>
   <p>The <dfn title="attr-script-async"><code>async</code></dfn> and
   <dfn title="attr-script-defer"><code>defer</code></dfn> attributes
   are <span title="boolean attribute">boolean attributes</span> that
   indicate how the script should be executed.</p>
   <p>There are three possible modes that can be selected using these
   attributes. If the <code title="attr-script-async">async</code>
   attribute is present, then the script will be executed
   asynchronously, as soon as it is available. If the <code
   title="attr-script-async">async</code> attribute is not present but
@@ -10417,20 +10414,27 @@ people expect to have work and what is necessary.
     <p>For historical reasons, if the <span>URL</span> is a <span
     title="javascript protocol"><code title="">javascript:</code>
     URL</span>, then the user agent must not, despite the requirements
     in the definition of the <span title="fetch">fetching</span>
     algorithm, actually execute the given script; instead the user
     agent must act as if it had received an empty HTTP 400
+    <p>Once the resource's <span title="Content-Type">Content Type
+    metadata</span> is available, if it ever is, apply the
+    <span>algorithm for extracting an encoding from a
+    Content-Type</span> to it. If this returns an encoding, and the
+    user agent supports that encoding, then let <var>the script
+    block's character encoding</var> be that encoding.</p>
     <p>Once the fetching process has completed, and the script has
     <dfn>completed loading</dfn>, the user agent will have to complete
     <span title="when a script completes loading">the steps described
     below</span>. (If the parser is still active at that time, those
     steps defer to the parser to handle the execution of pending
     <p>For performance reasons, user agents may start fetching the
     script as soon as the attribute is set, instead, in the hope that
     the element will be inserted into the document. Either way, once