Skip to content

Commit

Permalink
Merge pull request #446 from clavoline/french-qa-escapes
Browse files Browse the repository at this point in the history
QA escapes: FR translation + minor changes to EN
  • Loading branch information
r12a committed Feb 27, 2023
2 parents a4bd694 + 3e706ca commit 3f0436a
Show file tree
Hide file tree
Showing 2 changed files with 323 additions and 15 deletions.
30 changes: 15 additions & 15 deletions questions/qa-escapes.en.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ <h2 id="quickanswer">Quick answer</h2>
</thead>
<tbody>
<tr>
<td>&amp;#<code>x20AC</code>;</td>
<td><code>&amp;#x20AC;</code></td>
<td>hexadecimal numeric character reference</td></tr>
<tr>
<td>&amp;#8364;</td>
<td><code>&amp;#8364;</code></td>
<td>decimal numeric character reference</td>
</tr>
<tr>
<td>&amp;euro;</td>
<td><code>&amp;euro;</code></td>
<td>named character reference</td>
</tr>
</tbody>
Expand All @@ -93,15 +93,15 @@ <h2 id="quickanswer">Quick answer</h2>
</thead>
<tbody>
<tr>
<td>\20AC </td>
<td><code>\20AC</code></td>
<td>must be followed by a space if the next character is one of a-f, A-F, 0-9</td></tr>
<tr>
<td>\0020AC</td>
<td><code>\0020AC</code></td>
<td>must be 6 digits long, no space needed (but can be included)</td>
</tr>
</tbody>
</table>
<p>A trailing space is treated as part of the escape, so use 2 spaces if you actually want to follow the escaped character with a space. If using escapes in CSS identifiers, see the additional rules below.</p>
<p>A trailing space is treated as part of the escape, so use 2 spaces if you actually want to follow the escaped character with a space. If using escapes in CSS identifiers, see the <a href="#css_identifiers">additional rules below</a>.</p>
<p>Because you should use UTF-8 for the character encoding of the page, you won't normally need to use character escapes. You may however find them useful to represent invisible or ambiguous characters, or characters that would otherwise interact in undesirable ways with the surrounding source code or text.</p>
<p>For more details, see below.</p>
</section>
Expand Down Expand Up @@ -206,14 +206,14 @@ <h2> When not to use escapes</h2>
</blockquote>
<p>As we said before, use characters rather than escapes for ordinary text.</p>
<p id="useinxhtml"><strong class="leadin">Use in XHTML.</strong> Using named character references in a document that is parsed as XML may become problematic if the entities are defined externally to your document and the tools that process the XML do not read the external files. In such cases the entity references will not be replaced by characters. For this reason, if you need to use escapes, it may be safer to use numeric character references, or define the character entities you need inside the document. </p>
<p>If you use <a class="print" href="https://www.w3.org/TR/html5/syntax.html#named-character-references">HTML-defined named character references </a> (such as <code translate="no">&amp;aacute;</code>) to represent characters in XHTML, you should take care any time your content is processed using XML parsers or other tools.</p>
<p>If you use <a class="print" href="https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references">HTML-defined named character references </a> (such as <code translate="no">&amp;aacute;</code>) to represent characters in XHTML, you should take care any time your content is processed using XML parsers or other tools.</p>
</section>




<section id="use">
<h2>When escapes can be useful</h2>
<h2>When escapes can be useful</h2>
<p><strong class="leadin">Syntax characters.</strong> There are three characters that should always appear in content as escapes, so that they do not interact with the syntax of the markup. These are part of the language for all documents based on HTML and for XML.</p>
<ul>
<li>
Expand Down Expand Up @@ -241,7 +241,7 @@ <h2>When escapes can be useful</h2>

<section id="styleattr">
<h2>Using escapes in style attributes</h2>
<p>It is usually a good idea to put style information in an external style sheet or a <span class="kw">style</span> element in the head of an HTML file. Occasionally, or perhaps on a temporary basis, you may use a <span class="kw">style</span> <em>attribute</em> on a particular element, instead. Even more rarely, you may want to represent one or more characters in the <span class="kw">style</span> attribute using character escapes.</p>
<p>It is usually a good idea to put style information in an external style sheet or a <span class="kw">style</span> element in the <span class="kw">head</span> of an HTML file. Occasionally, or perhaps on a temporary basis, you may use a <span class="kw">style</span> <em>attribute</em> on a particular element, instead. Even more rarely, you may want to represent one or more characters in the <span class="kw">style</span> attribute using character escapes.</p>
<p>A <span class="kw">style</span> attribute in HTML can represent characters using numeric or named character references or CSS escapes. On the other hand, the <span class="kw">style</span> <em>element</em> in HTML can contain neither numeric nor named character references, and the same applies to an external style sheet.</p>
<p>Because there is a tendency to want to move styles declared in attributes to the style element or an external style sheet (for example, this might be done automatically using an application or script), it is safest to use only CSS escapes.</p>
<p>For example, it is better to use</p>
Expand All @@ -262,11 +262,11 @@ <h2>By the way</h2>
<p><strong class="leadin">Changing to UTF-8 means re-saving your file.</strong> Using the character encoding UTF-8 for your page means that you can avoid the
need for most escapes and just work with characters. Note, however, that to change the encoding of your document, it is not enough to just change the encoding
declaration at the top of the page or on the server. You need to re-save your document in that encoding. For help understanding how to do that with
your application read <a class="print" href="/International/questions/qa-setting-encoding-in-applications"><cite>Setting encoding in web authoring applications</cite></a>.</p>
<p><span class="leadin">Hex vs. decimal. </span>Typically when the Unicode Standard refers to or lists characters it does so using a hexadecimal value. For instance, the code point
your application read <a class="print" href="/International/questions/qa-choosing-encodings"><cite>Choosing & applying a character encoding</cite></a>.</p>
<p><strong class="leadin">Hex vs. decimal. </strong>Typically when the Unicode Standard refers to or lists characters it does so using a hexadecimal value. For instance, the code point
for the letter <span class="qchar">á</span> may be referred to as <span class="uname">U+00E1</span>. Given the prevalence of this convention, it is often useful, though not
required, to use hexadecimal numeric values in escapes rather than decimal values. You do not need to use leading zeros in escapes, ie. <span class="qchar">á</span> could be represented as <code>&amp;#xE1;</code>.</p>
<p id="suppchars"><span class="leadin">Supplementary characters. </span>Supplementary characters are those Unicode characters beyond the <a href="/International/articles/definitions-characters/#unicode" class="dfn print">Basic Multilingual Plane (BMP)</a>. In UTF-16 a supplementary character is encoded using two 16-bit <dfn>surrogate code points</dfn> from the BMP. Because of
<p id="suppchars"><strong class="leadin">Supplementary characters. </strong>Supplementary characters are those Unicode characters beyond the <a href="/International/articles/definitions-characters/#unicode" class="dfn print">Basic Multilingual Plane (BMP)</a>. In UTF-16 a supplementary character is encoded using two 16-bit <dfn>surrogate code points</dfn> from the BMP. Because of
this, or because of experience with older version s of JavaScript syntax, some people think that supplementary characters need to be represented using two escapes, but this is incorrect – you must use the single,
code point value for that character. For example, use <code>&amp;#x233B4;</code> rather than <code>&amp;#xD84C;&amp;#xDFB4;</code>.</p>
<p id="ampersands"><strong class="leadin">Single ampersands.</strong> Although HTML user agents have tended to turn a blind eye, you should never have a single ampersand (<span class="qchar">&amp;</span>) in your HTML document. You should pay particular attention to URIs that include parameters. For example, your document should contain <code>http://example.org/my-script.php?class=guest<span class="highlight">&amp;amp;</span>name=user</code>, rather than <code>http://example.org/my-script.php?class=guest<span class="highlight">&amp;</span>name=user</code>.</p>
Expand All @@ -289,21 +289,21 @@ <h2>Further reading</h2>
<li>
<p>Related links, <cite>Authoring HTML &amp; CSS</cite></p>
<ul>
<li><a href="/International/techniques/authoring-html#charset">Characters</a></li>
<li><a href="/International/techniques/authoring-html#charset">HTML characters</a></li>
<li><a href="/International/techniques/authoring-html#escapes">Using escapes to represent characters</a></li>
</ul>
</li>
<li>
<p>Related links, <cite>Authoring XML</cite></p>
<ul>
<li><a href="/International/techniques/authoring-xml#charset">Characters</a></li>
<li><a href="/International/techniques/authoring-xml#charset">XML characters</a></li>
<li><a href="/International/techniques/authoring-xml#escapes">Using escapes to represent characters</a></li>
</ul>
</li>
<li>
<p>Related links, <cite>Developing specifications</cite></p>
<ul>
<li><a href="/International/techniques/developing-specs#char_escapes">Designing character escapes</a></li>
<li><a href="https://www.w3.org/TR/international-specs/#char_escapes">Designing character escapes</a></li>
</ul>
</li>
</ul>
Expand Down
Loading

0 comments on commit 3f0436a

Please sign in to comment.