spec/Overview.html 1.1973 2802 Support BOMs in <script src=''> JS files

Support BOMs in <script src=''> JS files. (credit: mp) (whatwg r2802)

confidence
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1973.html#concept-encoding-confidence
the script block's source
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1973.html#the-script-block-s-source
2.7.3 Content-Type sniffing: text or binary
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1973.html#content-type-sniffing:-text-or-binary

http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html
http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.1972&r2=1.1973&f=h
http://html5.org/tools/web-apps-tracker?from=2801&to=2802

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.1972
retrieving revision 1.1973
diff -u -d -r1.1972 -r1.1973
--- Overview.html 12 Feb 2009 10:36:13 -0000 1.1972
+++ Overview.html 12 Feb 2009 10:46:23 -0000 1.1973
@@ -4288,6 +4288,7 @@
     <p>If <var title="">n</var> is 4 or more, and the first bytes of
     the resource match one of the following byte sets:</p>
 
+    <!-- this table is present in several forms in this file; keep them in sync -->
     <table><thead><tr><th>Bytes in Hexadecimal
        <th>Description
      <tbody><tr><td>FE FF
@@ -8486,8 +8487,40 @@
         <p>The contents of that file, interpreted as string of
         Unicode characters, are the script source.</p>
 
-        <p>The file must be converted to Unicode using the character
-        encoding given by <var><a href=#the-script-block-s-character-encoding>the script block's character
+        <p>For each of the rows in the following table, starting with
+        the first one and going down, if the file has as many or more
+        bytes available than the number of bytes in the first column,
+        and the first bytes of the file match the bytes given in the
+        first column, then set <var><a href=#the-script-block-s-character-encoding>the script block's character
+        encoding</a></var> to the encoding given in the cell in the second
+        column of that row, irrespective of any previous value:</p>
+
+        <!-- this table is present in several forms in this file; keep them in sync -->
+        <table><thead><tr><th>Bytes in Hexadecimal
+           <th>Encoding
+         <tbody><!-- nobody uses this
+          <tr>
+           <td>00 00 FE FF
+           <td>UTF-32BE
+          <tr>
+           <td>FF FE 00 00
+           <td>UTF-32LE
+--><tr><td>FE FF
+           <td>UTF-16BE
+          <tr><td>FF FE
+           <td>UTF-16LE
+          <tr><td>EF BB BF
+           <td>UTF-8
+<!-- nobody uses this
+          <tr>
+           <td>DD 73 66 73
+           <td>UTF-EBCDIC
+-->
+        </table><p class=note>This step looks for Unicode Byte Order Marks
+        (BOMs).</p>
+
+        <p>The file must then be converted to Unicode using the
+        character encoding given by <var><a href=#the-script-block-s-character-encoding>the script block's character
         encoding</a></var>.</p>
 
        </dd>
@@ -38866,6 +38899,7 @@
    that row, with the <a href=#concept-encoding-confidence title=concept-encoding-confidence>confidence</a>
    <i>certain</i>, and abort these steps:</p>
 
+    <!-- this table is present in several forms in this file; keep them in sync -->
     <table><thead><tr><th>Bytes in Hexadecimal
        <th>Encoding
      <tbody><!-- nobody uses this

Received on Thursday, 12 February 2009 10:49:55 UTC