You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<pclass=note> Note: This mimics HTML <code><meta></code> behavior.
419
423
420
424
<li>
421
-
Otherwise, <adata-link-type=dfnhref=#get-an-encodingtitle="get an encoding">get an encoding</a> for the value of the <code>charset</code> attribute on the <code><link></code> element or <code><?xml-stylesheet?></code> processing instruction that caused the style sheet to be included, if any.
422
-
If that does not return failure,
423
-
use the return value as the fallback encoding.
424
-
425
-
<li>
426
-
Otherwise, if the referring style sheet or document has an encoding,
425
+
Otherwise, if an <adata-link-type=dfnhref=#environment-encoding0title="environment encoding">environment encoding</a> is provided by the referring document,
<p>Document languages that refer to CSS stylesheets that are decoded from bytes
441
+
must define an <dfndata-dfn-type=dfndata-noexport="" id=environment-encoding0>environment encoding<aclass=self-linkhref=#environment-encoding0></a></dfn> for each such stylesheet,
442
+
which is used as a fallback when other encoding hints are not available or can not be used.
<p> For stylesheets referred to by an <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-cascade-3/#at-ruledef-importtitle=@import>@import</a> CSS rule <adata-biblio-type=normativedata-link-type=bibliohref=#css3cascadetitle=css3cascade>[CSS3CASCADE]</a>,
448
+
the <adata-link-type=dfnhref=#environment-encoding0title="environment encoding">environment encoding</a> is the encoding of the referring stylesheet.
449
+
450
+
<pclass=note> Note: this should be moved to <adata-biblio-type=informativedata-link-type=bibliohref=#css3cascadetitle=css3cascade>[CSS3CASCADE]</a>.
<p> For stylesheets referred to by an HTML <ahref=http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#link-type-stylesheet><code><link rel=stylesheet></code></a> element,
456
+
the <adata-link-type=dfnhref=#environment-encoding0title="environment encoding">environment encoding</a> is the encoding of the referring document.
457
+
458
+
<pclass=note> Note: this should be moved to the HTML spec.
<p> For stylesheets referred to by an <ahref=http://www.w3.org/TR/xml-stylesheet/#the-xml-stylesheet-processing-instruction><code>xml-stylesheet</code></a> processing instruction <adata-biblio-type=normativedata-link-type=bibliohref=#xmlstyletitle=xmlstyle>[XMLSTYLE]</a>,
464
+
the <adata-link-type=dfnhref=#environment-encoding0title="environment encoding">environment encoding</a> is determined as follows:
<adata-link-type=dfnhref=#get-an-encodingtitle="get an encoding">Get an encoding</a> for the value of the <code>charset</code><ahref=http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute>pseudo-attribute</a> on processing instruction, if any.
469
+
If that does not return failure,
470
+
use the return value as the environment encoding.
471
+
472
+
<li>
473
+
Otherwise, use the encoding of the referring document.
474
+
</ul>
475
+
476
+
<pclass=note> Note: This should be moved to <adata-biblio-type=informativedata-link-type=bibliohref=#cssomtitle=cssom>[CSSOM]</a>.
Copy file name to clipboardExpand all lines: css-syntax/Overview.src.html
+41-10Lines changed: 41 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -304,12 +304,7 @@ <h3 id="input-byte-stream">
304
304
Note: This mimics HTML <code><meta></code> behavior.
305
305
306
306
<li>
307
-
Otherwise, <a>get an encoding</a> for the value of the <code>charset</code> attribute on the <code><link></code> element or <code><?xml-stylesheet?></code> processing instruction that caused the style sheet to be included, if any.
308
-
If that does not return failure,
309
-
use the return value as the fallback encoding.
310
-
311
-
<li>
312
-
Otherwise, if the referring style sheet or document has an encoding,
307
+
Otherwise, if an <a>environment encoding</a> is provided by the referring document,
313
308
use that as the fallback encoding.
314
309
315
310
<li>
@@ -321,10 +316,46 @@ <h3 id="input-byte-stream">
321
316
Note: the <a>decode</a> algorithm lets the byte order mark (BOM) take precedence,
322
317
hence the usage of the term "fallback" above.
323
318
324
-
<pclass='issue'>
325
-
Anne says that steps 3/4 should be an input to this algorithm from the specs that define importing stylesheet,
326
-
to make the algorithm as a whole cleaner.
327
-
Perhaps abstract it into the concept of an "environment charset" or something?
319
+
<h3id="environment-encoding">
320
+
Environment encoding</h3>
321
+
322
+
Document languages that refer to CSS stylesheets that are decoded from bytes
323
+
must define an <dfn>environment encoding</dfn> for each such stylesheet,
324
+
which is used as a fallback when other encoding hints are not available or can not be used.
325
+
326
+
<h4id="environment-encoding-at-import">
327
+
''@import'' rules</h4>
328
+
329
+
For stylesheets referred to by an ''@import'' CSS rule [[!CSS3CASCADE]],
330
+
the <a>environment encoding</a> is the encoding of the referring stylesheet.
331
+
332
+
Note: this should be moved to [[CSS3CASCADE]].
333
+
334
+
<h4id="environment-encoding-html">
335
+
HTML</h4>
336
+
337
+
For stylesheets referred to by an HTML <ahref=http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#link-type-stylesheet><code><link rel=stylesheet></code></a> element,
338
+
the <a>environment encoding</a> is the encoding of the referring document.
339
+
340
+
Note: this should be moved to the HTML spec.
341
+
342
+
<h4id="environment-encoding-xml">
343
+
XML</h4>
344
+
345
+
For stylesheets referred to by an <ahref=http://www.w3.org/TR/xml-stylesheet/#the-xml-stylesheet-processing-instruction><code>xml-stylesheet</code></a> processing instruction [[!XMLSTYLE]],
346
+
the <a>environment encoding</a> is determined as follows:
347
+
348
+
<ul>
349
+
<li>
350
+
<a>Get an encoding</a> for the value of the <code>charset</code><ahref=http://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute>pseudo-attribute</a> on processing instruction, if any.
351
+
If that does not return failure,
352
+
use the return value as the environment encoding.
353
+
354
+
<li>
355
+
Otherwise, use the encoding of the referring document.
0 commit comments