[css-syntax] Limit @charset to 1024 bytes, like <meta charset> in HTML.

Mon, 27 Jan 2014 10:29:17 -0800

author
Simon Sapin <simon.sapin@exyr.org>
date
Mon, 27 Jan 2014 10:29:17 -0800
changeset 9811
8dd698785f16
parent 9810
74e9901cebea
child 9812
e8d109177c87

[css-syntax] Limit @charset to 1024 bytes, like <meta charset> in HTML.

css-syntax/Overview.html file | annotate | diff | comparison | revisions
css-syntax/Overview.src.html file | annotate | diff | comparison | revisions
     1.1 --- a/css-syntax/Overview.html	Sun Jan 26 18:38:22 2014 -0800
     1.2 +++ b/css-syntax/Overview.html	Mon Jan 27 10:29:17 2014 -0800
     1.3 @@ -54,7 +54,7 @@
     1.4  </p>
     1.5    <h1 class="p-name no-ref" id=title>CSS Syntax Module Level 3</h1>
     1.6    <h2 class="no-num no-toc no-ref heading settled heading" id=subtitle><span class=content>Editor’s Draft,
     1.7 -    <span class=dt-updated><span class=value-title title=20140124>24 January 2014</span></span></span></h2>
     1.8 +    <span class=dt-updated><span class=value-title title=20140127>27 January 2014</span></span></span></h2>
     1.9    <div data-fill-with=spec-metadata><dl><dt>This version:<dd><a class=u-url href=http://dev.w3.org/csswg/css-syntax/>http://dev.w3.org/csswg/css-syntax/</a><dt>Latest version:<dd><a href=http://www.w3.org/TR/css-syntax-3/>http://www.w3.org/TR/css-syntax-3/</a><dt>Editor’s Draft:<dd><a href=http://dev.w3.org/csswg/css-syntax/>http://dev.w3.org/csswg/css-syntax/</a><dt>Previous Versions:<dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20131105/</a><dd><a href=http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/ rel=previous>http://www.w3.org/TR/2013/WD-css-syntax-3-20130919/</a>
    1.10      <dt>Feedback:</dt>
    1.11          <dd><a href="mailto:www-style@w3.org?subject=%5Bcss-syntax%5D%20feedback">www-style@w3.org</a>
    1.12 @@ -446,7 +446,8 @@
    1.13  			use the return value as the fallback encoding.
    1.14  
    1.15  		<li>
    1.16 -			Otherwise, check the byte stream. If the byte stream begins with the hex sequence
    1.17 +			Otherwise, check the byte stream.
    1.18 +			If the first 1024 bytes of the stream begin with the hex sequence
    1.19  
    1.20  <pre>40 63 68 61 72 73 65 74 20 22 XX* 22 3B</pre>
    1.21  <p>			where each <code>XX</code> byte is between 23<sub>16</sub> and 7E<sub>16</sub> inclusive,
    1.22 @@ -4704,7 +4705,15 @@
    1.23  			<a data-biblio-type=informative data-link-type=biblio href=#encoding title=encoding>[ENCODING]</a> has been added to the list of normative references.
    1.24  			It was already referenced in normative text before,
    1.25  			just not listed as such.
    1.26 -	</ul>
    1.27 +		<li>
    1.28 +			In the algorithm to <a data-link-type=dfn href=#determine-the-fallback-encoding title="determine the fallback encoding">determine the fallback encoding</a> of a stylesheet,
    1.29 +			limit the <code>@charset</code> byte sequence to 1024 bytes.
    1.30 +			This aligns with what HTML does for <code>&lt;meta charset&gt;</code>
    1.31 +			and makes sure the size of the sequence is bounded.
    1.32 +			This only makes a difference with leading or trailing whitespace
    1.33 +			in the encoding label:
    1.34 +
    1.35 +<pre>@charset "   <em>(lots of whitespace)</em>   utf-8";</pre>	</ul>
    1.36  
    1.37  <h3 class="heading settled heading" data-level=10.2 id=changes-WD-20130919><span class=secno>10.2 </span><span class=content>
    1.38  Changes from the 19 September 2013 Working Draft</span><a class=self-link href=#changes-WD-20130919></a></h3>
     2.1 --- a/css-syntax/Overview.src.html	Sun Jan 26 18:38:22 2014 -0800
     2.2 +++ b/css-syntax/Overview.src.html	Mon Jan 27 10:29:17 2014 -0800
     2.3 @@ -283,7 +283,8 @@
     2.4  			use the return value as the fallback encoding.
     2.5  
     2.6  		<li>
     2.7 -			Otherwise, check the byte stream. If the byte stream begins with the hex sequence
     2.8 +			Otherwise, check the byte stream.
     2.9 +			If the first 1024 bytes of the stream begin with the hex sequence
    2.10  
    2.11  			<pre>40 63 68 61 72 73 65 74 20 22 XX* 22 3B</pre>
    2.12  
    2.13 @@ -3228,6 +3229,15 @@
    2.14  			[[ENCODING]] has been added to the list of normative references.
    2.15  			It was already referenced in normative text before,
    2.16  			just not listed as such.
    2.17 +		<li>
    2.18 +			In the algorithm to <a>determine the fallback encoding</a> of a stylesheet,
    2.19 +			limit the <code>@charset</code> byte sequence to 1024 bytes.
    2.20 +			This aligns with what HTML does for <code>&lt;meta charset></code>
    2.21 +			and makes sure the size of the sequence is bounded.
    2.22 +			This only makes a difference with leading or trailing whitespace
    2.23 +			in the encoding label:
    2.24 +
    2.25 +			<pre>@charset "   <em>(lots of whitespace)</em>   utf-8";</pre>
    2.26  	</ul>
    2.27  
    2.28  <h3 id="changes-WD-20130919">

mercurial