- From: Eliot Graff via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 27 Sep 2010 20:51:52 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/html-xhtml-author-guide In directory hutz:/tmp/cvs-serv18550 Modified Files: html-xhtml-authoring-guide.html Log Message: Rewrote character encoding section [bugs 9962, 10150, 10151, 10156]; changed wording in section 7, attributes, per bug 9965; Index: html-xhtml-authoring-guide.html =================================================================== RCS file: /sources/public/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- html-xhtml-authoring-guide.html 9 Sep 2010 00:22:55 -0000 1.27 +++ html-xhtml-authoring-guide.html 27 Sep 2010 20:51:50 -0000 1.28 @@ -375,6 +375,38 @@ padding: 3px 1em; } +/* --- Best Practices --- */ +div.practice { + border: solid #bebebe 1px; + margin: 2em 1em 1em 2em; +} + +span.practicelab { + margin: 1.5em 0.5em 1em 1em; + font-weight: bold; + font-style: italic; +} + +span.practicelab { background: #dfffff; } + +span.practicelab { + position: relative; + padding: 0 0.5em; + top: -1.5em; +} + +p.practicedesc { + margin: 1.5em 0.5em 1em 1em; +} + +@media screen { + p.practicedesc { + position: relative; + top: -2em; + padding: 0; + margin: 1.5em 0.5em -1em 1em; +} + /* --- SYNTAX HIGHLIGHTING --- */ pre.sh_sourceCode { background-color: white; @@ -443,7 +475,7 @@ pre.sh_sourceCode .sh_paren { color: red; } pre.sh_sourceCode .sh_attribute { color: #006400; } -</style><link charset="utf-8" type="text/css" rel="stylesheet" href="html-xhtml-authoring-guide_files/W3C-ED.css"></head><body style="display: inherit;"><div class="head"><p><a href="http://www.w3.org/"><img src="html-xhtml-authoring-guide_files/w3c_home.png" alt="W3C" width="72" height="48"></a></p><h1 class="title" id="title">Polyglot Markup: HTML-Compatible XHTML Documents</h1><h2 id="w3c-editor-s-draft-08-september-2010">W3C Editor's Draft 08 September 2010</h2><dl><dt>This version:</dt><dd><a href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html">http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/html-polyglot/">http://www.w3.org/TR/html-polyglot/</a></dd><dt>Latest editor's draft:</dt><dd><a href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html">http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html</a></dd><d>Previous version:</dt><dd><a href="http://www.w3.org/TR/2010/WD-html-polyglot-20100624/">http://www.w3.org/TR/2010/WD-html-polyglot-20100624/</a></dd><dt>Editor:</dt><dd><span>Eliot Graff</span>, Microsoft Corporation</dd> +</style><link charset="utf-8" type="text/css" rel="stylesheet" href="html-xhtml-authoring-guide_files/W3C-ED.css"></head><body style="display: inherit;"><div class="head"><p><a href="http://www.w3.org/"><img src="html-xhtml-authoring-guide_files/w3c_home.png" alt="W3C" width="72" height="48"></a></p><h1 class="title" id="title">Polyglot Markup: HTML-Compatible XHTML Documents</h1><h2 id="w3c-editor-s-draft-27-september-2010">W3C Editor's Draft 27 September 2010</h2><dl><dt>This version:</dt><dd><a href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html">http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/html-polyglot/">http://www.w3.org/TR/html-polyglot/</a></dd><dt>Latest editor's draft:</dt><dd><a href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html">http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html</a></dd><d>Previous version:</dt><dd><a href="http://www.w3.org/TR/2010/WD-html-polyglot-20100624/">http://www.w3.org/TR/2010/WD-html-polyglot-20100624/</a></dd><dt>Editor:</dt><dd><span>Eliot Graff</span>, Microsoft Corporation</dd> </dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2010 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p><hr></div> <div class="introductory section" id="abstract"><h2>Abstract</h2>A @@ -485,7 +517,7 @@ as other than work in progress.</p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. W3C maintains a <a href="" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has -actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p></div><div class="section" id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a class="tocxref" href="#introduction"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a class="tocxref" href="#PI-and-xml"><span class="secno">2. </span>Processing Instructions and the XML Declaration</a></li><li class="tocline"><a class="tocxref" href="#character-encoding"><span class="secno">3. </span>Character Encoding</a></li><li class="tocline"><a class="tocxref" href="#doctype"><span class="secno">4. </span>The DOCTYPE</a></li><li class="tocline"><a class="tocxref" href="#namespaces"><span class="secno">5. </span>Namespaces</a<ul class="toc"><li class="tocline"><a class="tocxref" href="#element-level-namespaces"><span class="secno">5.1 </span>Element-Level Namespaces</a></li><li class="tocline"><a class="tocxref" href="#attribute-level-namespaces"><span class="secno">5.2 </span>Attribute-Level Namespaces</a></li></ul></li><li class="tocline"><a class="tocxref" href="#elements"><span class="secno">6. </span>Elements</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#required-elements"><span class="secno">6.1 </span>Required Elements</a></li><li class="tocline"><a class="tocxref" href="#case-sensitivity"><span class="secno">6.2 </span>Case-Sensitivity</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#element-names"><span class="secno">6.2.1 </span>Element Names</a></li><li class="tocline"><a class="tocxref" href="#attribute-names"><span class="secno">6.2.2 </span>Attribute Names</a></li><li class="tocline"><a class="tocxref" href="#attribute-values"><span class="secno">6.2.3 </span>Attribute Values</a>/li></ul></li><li class="tocline"><a class="tocxref" href="#empty-elements"><span class="secno">6.3 </span>Empty Elements</a></li><li class="tocline"><a class="tocxref" href="#elements-with-soecial-considerations"><span class="secno">6.4 </span>Elements with Special Considerations</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#white-space-in-textarea-and-pre"><span class="secno">6.4.1 </span>White Space in <code><textarea></code> and <code><pre></code> Elements</a></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#attributes"><span class="secno">7. </span>Attributes</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#disallowed-attributes"><span class="secno">7.1 </span>Disallowed Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#named-entity-references"><span class="secno">8. </span>Named Entity References</a></li><li class="tocline"><a class="tocxref" href="#script-and-style"><span class="secno">9. </span>Script and Stle</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#external-script-and-style"><span class="secno">9.1 </span>External Script and Style</a></li><li class="tocline"><a class="tocxref" href="#in-line-script-and-style"><span class="secno">9.2 </span>In-line Script and Style</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#safe-content"><span class="secno">9.2.1 </span>Safe Content</a></li><li class="tocline"><a class="tocxref" href="#wrapping-in-cdata"><span class="secno">9.2.2 </span>Wrapping a Command in a CDATA Section</a></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#foreign-content"><span class="secno">10. </span>Exceptions from the Foreign Content Parsing Rules</a></li><li class="tocline"><a class="tocxref" href="#acknowledgements"><span class="secno">A. </span>Acknowledgements</a></li><li class="tocline"><a class="tocxref" href="#references"><span class="secno">B. </span>References</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#nomative-references"><span class="secno">B.1 </span>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><span class="secno">B.2 </span>Informative references</a></li></ul></li></ul></div> +actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p></div><div class="section" id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a class="tocxref" href="#introduction"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a class="tocxref" href="#PI-and-xml"><span class="secno">2. </span>Processing Instructions and the XML Declaration</a></li><li class="tocline"><a class="tocxref" href="#character-encoding"><span class="secno">3. </span>Specifying a Document's Character Encoding</a></li><li class="tocline"><a class="tocxref" href="#doctype"><span class="secno">4. </span>The DOCTYPE</a></li><li class="tocline"><a class="tocxref" href="#namespaces"><span class="secno"5. </span>Namespaces</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#element-level-namespaces"><span class="secno">5.1 </span>Element-Level Namespaces</a></li><li class="tocline"><a class="tocxref" href="#attribute-level-namespaces"><span class="secno">5.2 </span>Attribute-Level Namespaces</a></li></ul></li><li class="tocline"><a class="tocxref" href="#elements"><span class="secno">6. </span>Elements</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#required-elements"><span class="secno">6.1 </span>Required Elements</a></li><li class="tocline"><a class="tocxref" href="#case-sensitivity"><span class="secno">6.2 </span>Case-Sensitivity</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#element-names"><span class="secno">6.2.1 </span>Element Names</a></li><li class="tocline"><a class="tocxref" href="#attribute-names"><span class="secno">6.2.2 </span>Attribute Names</a></li><li class="tocline"><a class="tocxref" href="#attribute-values"><span class="secno">6.2.3 </san>Attribute Values</a></li></ul></li><li class="tocline"><a class="tocxref" href="#empty-elements"><span class="secno">6.3 </span>Empty Elements</a></li><li class="tocline"><a class="tocxref" href="#elements-with-soecial-considerations"><span class="secno">6.4 </span>Elements with Special Considerations</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#white-space-in-textarea-and-pre"><span class="secno">6.4.1 </span>White Space in <code><textarea></code> and <code><pre></code> Elements</a></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#attributes"><span class="secno">7. </span>Attributes</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#disallowed-attributes"><span class="secno">7.1 </span>Disallowed Attributes</a></li></ul></li><li class="tocline"><a class="tocxref" href="#named-entity-references"><span class="secno">8. </span>Named Entity References</a></li><li class="tocline"><a class="tocxref" href="#script-and-style"><span class="secno"9. </span>Script and Style</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#external-script-and-style"><span class="secno">9.1 </span>External Script and Style</a></li><li class="tocline"><a class="tocxref" href="#in-line-script-and-style"><span class="secno">9.2 </span>In-line Script and Style</a><ul class="toc"><li class="tocline"><a class="tocxref" href="#safe-content"><span class="secno">9.2.1 </span>Safe Content</a></li><li class="tocline"><a class="tocxref" href="#wrapping-in-cdata"><span class="secno">9.2.2 </span>Wrapping a Command in a CDATA Section</a></li></ul></li></ul></li><li class="tocline"><a class="tocxref" href="#foreign-content"><span class="secno">10. </span>Exceptions from the Foreign Content Parsing Rules</a></li><li class="tocline"><a class="tocxref" href="#acknowledgements"><span class="secno">A. </span>Acknowledgements</a></li><li class="tocline"><a class="tocxref" href="#references"><span class="secno">B. </span>References</a><ul class="toc"><li class="tocline"><a cass="tocxref" href="#normative-references"><span class="secno">B.1 </span>Normative references</a></li><li class="tocline"><a class="tocxref" href="#informative-references"><span class="secno">B.2 </span>Informative references</a></li></ul></li></ul></div> @@ -512,34 +544,39 @@ <div id="character-encoding" class="section"> -<!--OddPage--><h2><span class="secno">3. </span>Character Encoding</h2> -<p> - Polyglot markup uses either UTF-8 or UTF-16, although generally UTF-8 is preferred. - When polyglot markup uses UTF-16, it <em title="must" class="rfc2119">must</em> - include the BOM indicating UTF-16LE or UTF-16BE. - Polyglot markup need not include the meta charset declaration, because -the parser would have to read UTF-16 in order to parse it by definition. - - However, the W3C Internationalization (i18n) Group recommends to always - include a visible encoding declaration in a document, because it helps -developers, testers, or translation production managers to check the -encoding of a document visually. - <!-- TODO: need citation --> -</p> -<p> - In short, for correct character encoding, polyglot markup <em title="must" class="rfc2119">must</em> either: - </p><ul> - <li>Use UTF-8 or UTF-16 with the appropriate BOM.</li> - </ul> - <strong>OR</strong> - <ul> - <li>Use both the XML Declaration and <code>meta</code> tag to specify the appropriate character encoding.</li> - </ul> +<!--OddPage--><h2><span class="secno">3. </span>Specifying a Document's Character Encoding</h2> <p> - If polyglot markup uses an encoding other than UTF-8 or UTF-16, it <em title="must" class="rfc2119">must</em> include the XML declaration; however, in this case the document <em title="must" class="rfc2119">must</em> also include the HTML <code>meta</code> tag specifying the character set. - When polyglot markup uses both the XML declaration and the HTML <code>meta</code> tag, these <em title="must" class="rfc2119">must</em> specify the same character and coding. + Polyglot markup uses either UTF-8 or UTF-16. UTF-8 is preferred. + When polyglot markup uses UTF-16, it <em title="must" class="rfc2119">must</em> include the BOM indicating UTF-16LE or UTF-16BE. + </p> + <p> + Polyglot markup declares character encoding one of two ways: + </p><ul> + <li>By using the BOM.</li> + <li>In the HTTP header of the response [<cite><a href="#bib-HTTP11" rel="biblioentry" class="bibref">HTTP11</a></cite>], as in the following: + <p> + <code>Content-type: text/html; charset=utf-8</code> + <br> + or + <br> + <code>Content-type: text/html; charset=utf-16</code> + </p> + Note that polyglot markup may use either <code>text/html</code> or <code>application/xhtml+xml</code> for the value of the content type. + </li> + </ul> + <p></p> + <p> + Using <code><meta charset="*"/></code> has no effect in XML. + Therefore, polyglot markup <em title="may" class="rfc2119">may</em> use <code><meta charset="*"/></code> in combination with BOM, as long the meta element specifies the same character encoding as the BOM. + In addition, the meta tag <em title="may" class="rfc2119">may</em> be +used in the absence of a BOM as long as it matches the already specified + encoding. + Note that the W3C Internationalization (i18n) Group recommends to +always include a visible encoding declaration in a document, because it +helps developers, testers, or translation production managers to check +the encoding of a document visually. + <!-- TODO: need citation for i18n recommendation --> </p> -<p></p> </div> <div id="doctype" class="section"> @@ -912,8 +949,7 @@ <div id="attributes" class="section"> <!--OddPage--><h2><span class="secno">7. </span>Attributes</h2> -<p>Polyglot markup does not contain line breaks and multiple white space characters within attribute values. - These are handled inconsistently by user agents. +<p>Because of attribute-value normalization in XML [<cite><a href="#bib-XML10" rel="biblioentry" class="bibref">XML10</a></cite>], polyglot markup does not contain tabs, line feeds, or carriage returns within CDATA attributes. </p> <p>Polyglot markup surrounds all attribute values with quotation marks. Attribute values <em title="may" class="rfc2119">may</em> be surrounded either by single quotation marks or by double quotation marks.</p> <p>See also <a href="#attribute-values">Attribute Values</a>.</p> @@ -1037,6 +1073,7 @@ </div> <div class="appendix section" id="references"><!--OddPage--><h2><span class="secno">B. </span>References</h2><div class="section" id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/2010/WD-html5-20100304/"><cite>HTML 5.</cite></a> 4 March 2010. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2010/WD-html5-20100304/">http://www.w3.org/TR/2010/WD-html5-20100304/</a> +</dd><dt id="bib-HTTP11">[HTTP11]</dt><dd>R. Fielding; et al. <a href="http://www.ietf.org/rfc/rfc2616.txt"><cite>Hypertext Transfer Protocol - HTTP/1.1.</cite></a> June 1999. Internet RFC 2616. URL: <a href="http://www.ietf.org/rfc/rfc2616.txt">http://www.ietf.org/rfc/rfc2616.txt</a> </dd><dt id="bib-RFC2854">[RFC2854]</dt><dd>D. Connolly; L. Masinter. <a href="http://www.rfc-editor.org/rfc/rfc2854.txt"><cite>The 'text/html' Media Type.</cite></a> June 2000. Internet RFC 2854. URL: <a href="http://www.rfc-editor.org/rfc/rfc2854.txt">http://www.rfc-editor.org/rfc/rfc2854.txt</a> </dd><dt id="bib-XML10">[XML10]</dt><dd>C. M. Sperberg-McQueen; et al. <a href="http://www.w3.org/TR/2008/REC-xml-20081126/"><cite>Extensible Markup Language (XML) 1.0 (Fifth Edition).</cite></a> 26 November 2008. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2008/REC-xml-20081126/">http://www.w3.org/TR/2008/REC-xml-20081126/</a> </dd></dl></div><div class="section" id="informative-references"><h3><span class="secno">B.2 </span>Informative references</h3><p>No informative references.</p></div></div></body></html> \ No newline at end of file
Received on Monday, 27 September 2010 20:51:55 UTC