De Wikipedia, la enciclopedia libre
  (Redirigido desde la referencia de entidad de carácter )
Saltar a navegación Saltar a búsqueda

En documentos SGML, HTML y XML, las construcciones lógicas conocidas como datos de caracteres y valores de atributos consisten en secuencias de caracteres, en las que cada carácter puede manifestarse directamente (representándose a sí mismo), o puede ser representado por una serie de caracteres denominada referencia de carácter , de los cuales hay dos tipos: una referencia de carácter numérico y una referencia de entidad de carácter . Este artículo enumera las referencias a entidades de caracteres que son válidas en documentos HTML y XML.

Una referencia de entidad de carácter se refiere al contenido de una entidad nombrada. Una declaración de entidad se crea utilizando la <!ENTITY name "value">sintaxis en una Definición de tipo de documento (DTD).

Descripción general de la referencia de personajes [ editar ]

Una referencia de carácter numérico se refiere a un carácter por su punto de código Unicode / Conjunto de caracteres universal y utiliza el formato:

&#nnnn;

o

&#xhhhh;

donde nnnn es el punto de código en forma decimal y hhhh es el punto de código en forma hexadecimal . La x debe estar en minúsculas en los documentos XML. El nnnn o hhhh puede tener cualquier número de dígitos y puede incluir ceros a la izquierda. El hhhh puede mezclar mayúsculas y minúsculas, aunque mayúsculas es el estilo habitual.

Por el contrario, una referencia de entidad de carácter se refiere a un carácter por el nombre de una entidad que tiene el carácter deseado como texto de reemplazo . La entidad debe estar predefinida (incorporada en el lenguaje de marcado) o declarada explícitamente en una Definición de tipo de documento (DTD). El formato es el mismo que para cualquier referencia de entidad:

&nombre;

donde nombre es el nombre de la entidad que distingue entre mayúsculas y minúsculas. Se requiere el punto y coma, a menos que se indique lo contrario en la tabla siguiente (consulte [a] ).

Conjuntos de entidades públicas estándar para personajes [ editar ]

Conjuntos de entidades ISO : SGML proporcionó un conjunto completo de declaraciones de entidades para caracteres ampliamente utilizados en publicaciones técnicas y de referencia occidentales, para escrituras latinas, griegas y cirílicas. La American Mathematical Society también contribuyó con entidades para caracteres matemáticos.

Conjuntos de entidades HTML : las primeras versiones de HTML incorporadas en pequeños subconjuntos de estos, relacionados con los caracteres que se encuentran en tres fuentes occidentales de 8 bits.

Conjuntos de entidades MathML : El W3C desarrolló un conjunto de declaraciones de entidades para caracteres MathML .

Conjuntos de entidades XML : El Grupo de Trabajo W3C MathML se hizo cargo del mantenimiento de los conjuntos de entidades públicas ISO, combinados con MathML y ​​los documenta en Definiciones de Entidades XML para Caracteres . Este conjunto puede soportar los requisitos de XHTML , MathML y como entrada para futuras versiones de HTML.

HTML 5 : HTML5 adopta las entidades XML como referencias de caracteres con nombre , sin embargo, las reafirma sin hacer referencia a sus fuentes y no las agrupa en conjuntos. Además, la especificación HTML 5 proporciona asignaciones de los nombres a secuencias de caracteres Unicode mediante JSON .

Se han desarrollado muchos otros conjuntos de entidades para requisitos especiales y para scripts principales y minoritarios. Sin embargo, la llegada de Unicode los ha reemplazado en gran medida.

Entidades predefinidas en XML [ editar ]

La especificación XML no utiliza el término "entidad de carácter" o "referencia de entidad de carácter". La especificación XML define cinco "entidades predefinidas" que representan caracteres especiales y requiere que todos los procesadores XML los respeten. Las entidades también se pueden declarar explícitamente en una DTD, pero si se hace esto, el texto de reemplazo debe ser el mismo que el de las definiciones integradas. XML también permite definir otras entidades con nombre de cualquier tamaño por documento.

La siguiente tabla enumera las cinco entidades XML predefinidas. La columna "Nombre" inicial menciona el nombre de la entidad. La columna "Personaje" muestra el carácter. Para renderizar el personaje, &name;se usa el formato ; por ejemplo, se &amp;representa como &. La columna "Punto de código Unicode" cita el carácter mediante la notación estándar UCS / Unicode "U +", que muestra el punto de código del carácter en hexadecimal. El equivalente decimal del punto de código se muestra entre paréntesis. La columna "Estándar" indica la primera versión de XML que incluye la entidad. La columna final "Nombre" cita al personaje a través de su nombre canónico UCS / Unicode.

Referencias de entidad de carácter en HTML [ editar ]

Las DTD de HTML 5 definen muchas entidades con nombre, cuyas referencias actúan como alias mnemotécnicos para ciertos caracteres Unicode. [1] La especificación HTML 5 requiere el uso de DTD estándar y no permite a los usuarios definir entidades adicionales.

En la siguiente tabla, la columna "Estándar" indica la primera versión de la DTD HTML que define la referencia de entidad de carácter. Para usar una de estas referencias de entidad de caracteres en un documento HTML o XML, ingrese un ampersand seguido del nombre de la entidad y un punto y coma , por ejemplo, ingrese &copy;el símbolo de copyright (©).

Alternativamente, ingrese un ampersand , seguido de un signo de número , un número y un punto y coma . Por ejemplo, para mostrar el símbolo de copyright ©, ingrese &#169;(cuando utilice este método, use los números decimales entre paréntesis en la tercera columna). De manera equivalente, puede ingresar un ampersand , seguido de un signo de número , la letra x , un número hexadecimal y un punto y coma . Por ejemplo, para mostrar el símbolo de copyright © introduzca &#x00A9;o &#xA9;. (Cuando use este método, use los números hexadecimales en la tercera columna, sin el prefijo U+).

Notes[edit]

  1. ^ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl cm cn co cp cq cr cs ct cu cv cw cx cy cz da db dc The trailing semicolon may be omitted for this named entity.
  2. ^ DTD: the full public DTD name (where the character entity name is defined) is actually mapped from one of the following three defined named entities:
    • HTMLlat1 maps to:
      • PUBLIC "-//W3C//ENTITIES Latin 1//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
      • PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent" in XHTML 1.0;
    • HTMLsymbol maps to:
      • PUBLIC "-//W3C//ENTITIES Symbols//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
      • PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent" in XHTML 1.0;
    • HTMLspecial maps to:
      • PUBLIC "-//W3C//ENTITIES Special//EN//HTML" in HTML (the DTD is implicitly defined, no system URI is needed);
      • PUBLIC "-//W3C//ENTITIES Special for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent" in XHTML 1.0.
  3. ^ Old ISO subset: these are old (documented) character subsets used in legacy encodings before the unification within ISO 10646.
  4. ^ Description: the standard ISO 10646 and Unicode character name is displayed first for each character, with non-standard but legacy synonyms shown in italics between parentheses after an equal sign.
  5. ^ a b c d spaces: a blue background is used to display each space's width.
  6. ^ angst: The use of U+212B 'Angstrom sign', which was encoded due to round-trip mapping compatibility with an East-Asian character encoding, is discouraged, and the preferred representation is U+00C5 'capital letter A with ring above', which has the same glyph.
  7. ^ a b ijlig: The use of U+0132 and U+0133 'IJ ligature', which was encoded for usage in Dutch, and for compatibility for ISO/IEC 6937 and Code page 1102 (which only includes the lowercase ij; the Dutch version of ISO 646, National Replacement Character Set), is discouraged, and the preferred representation is simply IJ and ij (as two separate letters).
  8. ^ a b lmidot: The use of U+013F and U+0140 'L with middle dot', which was encoded for usage in Catalan, and for compatibility for ISO/IEC 6937, is discouraged, and the preferred representation is L/l followed by U+00B7.
  9. ^ napost: U+0149 'n preceded by apostrophe', which was encoded for usage in Afrikaans, and for compatibility for ISO/IEC 6937, has been deprecated by Unicode (since Unicode 5.2). The preferred representation is ʼn (U+02BC followed by n). (Unicode.org - Proposal for Additional Deprecated Characters).
  10. ^ a b ligature: this is a standard misnomer as this is a separate character in some languages.
  11. ^ ohm: The use of U+2126 'Ohm sign', is discouraged, and the preferred representation is U+03A9 'Greek capital letter Omega', which has the same glyph.
  12. ^ a b c d e black: here it seems to mean filled as opposed to hollow.
  13. ^ a b ISO proposed: these characters have been standardized in ISO 10646 after the release of HTML 4.0.
  14. ^ alefsym: 'alef symbol' is not the same as U+05D0 'Hebrew letter alef', although the same glyph could be used to depict both characters.
  15. ^ beth: 'bet symbol' is not the same as U+05D1 'Hebrew letter bet', although the same glyph could be used to depict both characters.
  16. ^ gimel: 'gimel symbol' is not the same as U+05D2 'Hebrew letter gimel', although the same glyph could be used to depict both characters.
  17. ^ daleth: 'dalet symbol' is not the same as U+05D3 'Hebrew letter dalet', although the same glyph could be used to depict both characters.
  18. ^ lArr: ISO 10646 does not say that 'leftwards double arrow' is the same as the 'is implied by' arrow, but also does not have any other character for that function. So lArr can be used for 'is implied by' as ISOtech suggests.
  19. ^ rArr: ISO 10646 does not say that 'rightwards double arrow' is the 'implies' character but does not have another character with this function, so rArr can be used for 'implies' as ISOtech suggests.
  20. ^ prod: 'n-ary product' is not the same character as U+03A0 'Greek capital letter Pi' though the same glyph might be used for both.
  21. ^ sum: 'n-ary summation' is not the same character as U+03A3 'Greek capital letter Sigma' though the same glyph might be used for both.
  22. ^ sim: 'tilde operator' is not the same character as U+007E 'tilde', although the same glyph might be used to represent both.
  23. ^ nsup: note that nsup, U+2285 'not a superset of', is in the ISOamsn subset, but is not covered by the Symbol font encoding and is not listed in the HTML 4.0 entities list on the documentation, but was erroneously omitted from the entities list; it should be included for symmetry and analogy with other entities.
  24. ^ perp: Unicode only defines U+22A5 as the "up tack". The Unicode symbol for "perpendicular" is U+27C2. The two symbols look similar, but are separate in Unicode. However, HTML uses U+22A5 as its "perpendicular" symbol. This is a discrepancy between HTML and Unicode. As well, the U+22A4 character (the "down tack" symbol) rendered in a browser such as Firefox 3.6 can match the font of either "up tack" or "perpendicular", but not both, depending on whether a fixed-width or a proportional font is used. When viewed in Firefox 3.6, the symbols rendered in the order U+22A5, U+22A4, U+27C2 in a proportional font: ⊥ ⊤ ⟂ and a fixed width one: ⊥ ⊤ ⟂, shows that the "down tack" has a similar look to U+22A5 (HTML's "perpendicular") in the first case but matches U+27C2 in the second. This exemplifies the difficulties of the semiotics involved in interpreting glyphs, symbols and characters generally.
  25. ^ sdot: U+22C5 'dot operator' is not the same character as U+00B7 'middle dot'.
  26. ^ U+22D8 does not have the lll entity in the HTML 5.2 list, but was erroneously omitted from the list.
  27. ^ lang: U+27E8 'mathematical left angle bracket' is not the same character as U+003C 'less than', U+2039 'single left-pointing angle quotation mark', or U+3008 'left angle bracket'. In HTML 5.0, lang has was remapped to this code, as U+2329 'left-pointing angle bracket' has been marked deprecated in Unicode (since version 5.2) (Unicode.org - Proposal for Additional Deprecated Characters).
  28. ^ rang: U+27E9 'mathematical right angle bracket' is not the same character as U+003E 'greater than', U+203A 'single right-pointing angle quotation mark', or U+3009 'right angle bracket'. In HTML 5.0, rang had been remapped to this code, as U+232A 'right-pointing angle bracket' has been marked deprecated in Unicode (since version 5.2) (Unicode.org - Proposal for Additional Deprecated Characters).

Entities representing special characters in XHTML[edit]

The XHTML DTDs explicitly declare 253 entities (including the 5 predefined entities of XML 1.0) whose expansion is a single character, which can therefore be informally referred to as "character entities". These (with the exception of the &apos; entity) have the same names and represent the same characters as the 252 character entities in HTML. Also, by virtue of being XML, XHTML documents may reference the predefined &apos; entity, which is not one of the 252 character entities in HTML 4. Additional entities of any size may be defined on a per-document basis. However, the usability of entity references in XHTML is affected by how the document is being processed:

  • If the document is read by a conforming HTML processor, then only the 252 HTML character entities can safely be used. The use of &apos; or custom entity references may not be supported and may produce unpredictable results.
  • If the document is read by an XML parser that does not or cannot read external entities, then only the five built-in XML character entities (see above) can safely be used, although other entities may be used if they are declared in the internal DTD subset.
  • If the document is read by an XML parser that does read external entities, then the five built-in XML character entities can safely be used. The other 248 HTML character entities can be used as long as the XHTML DTD is accessible to the parser at the time the document is read. Other entities may also be used if they are declared in the internal DTD subset.

Because of the special &apos; case mentioned above, only &quot;, &amp;, &lt;, and &gt; will work in all processing situations.

References[edit]

  1. ^ "HTML5 Named Character Reference List".

See also[edit]

  • Character encodings in HTML
  • HTML decimal character rendering
  • SGML entity
  • Digraph and Trigraph (a similar concept to enter unavailable characters)

Further reading[edit]

  • Unicode Consortium. See also: Unicode Consortium
    • UnicodeData.txt from the Unicode Consortium
  • World Wide Web Consortium. See also: World Wide Web Consortium
    • XML 1.0 spec
    • HTML 2.0 spec
    • HTML 3.2 spec
    • HTML 4.0 spec
    • HTML 4.01 spec
    • HTML 5 spec
    • XHTML 1.0 spec
    • XML Entity Definitions for Characters
  • The normative reference to RFC 2070 (still found in DTDs defining the character entities for HTML or XHTML) is historic; this RFC (along with other RFC's related to different part of the HTML specification) has been deprecated in favor of the newer informational RFC 2854 which defines the "text/html" MIME type and references directly the W3C specifications for the actual HTML content.
  • Numerical Reference of Unicode code points at Wikibooks

External links[edit]

  • Character entity references in HTML 4 at the W3C
  • Webpage for encoding and decoding special characters