|Authors||Mark Davis (email@example.com), Asmus Freytag (firstname.lastname@example.org)|
This annex specifies an assignment of script names to all Unicode code points. This information is useful in mechanisms such as regular expressions and other text processing tasks.
This document has been reviewed by Unicode members and other interested parties, and has been approved for publication by the Unicode Consortium. This is a stable document and may be used as reference material or cited as a normative reference by other specifications.
A Unicode Standard Annex (UAX) forms an integral part of the Unicode Standard, but is published online as a separate document. The Unicode Standard may require conformance to normative content in a Unicode Standard Annex, if so specified in the Conformance chapter of that version of the Unicode Standard. The version number of a UAX document corresponds to the version of the Unicode Standard of which it forms a part.
Please submit corrigenda and other comments with the online reporting form [Feedback]. Related information that is useful in understanding this annex is found in Unicode Standard Annex #41, “Common References for Unicode Standard Annexes.” For the latest version of the Unicode Standard, see [Unicode]. For a list of current Unicode Technical Reports, see [Reports]. For more information about versions of the Unicode Standard, see [Versions].
Script: A collection of symbols used to represent textual information in one or more writing systems.
The majority of characters encoded in the Unicode Standard [Unicode] are elements of collections called scripts. Exceptions include symbols, punctuation characters intended for use with multiple scripts, and characters that do not have a stand-alone script identity because they are intended to be used in combination with another character.
Therefore, a text in a given script is likely to consist of characters from that script, together with shared punctuation and characters whose script identity depends on the characters with which they are used.
The Unicode Character Database [UCD] provides a mapping from Unicode characters to script name values. This information is useful for a variety of tasks that need to analyze a piece of text and determine what parts of it are in which script. Examples include regular expressions or assigning different fonts to parts of a plain text stream based on the prevailing script.
These processes are similar to the task of bibliographers in cataloging documents by their script. However, bibliographers often ignore small inclusions of other scripts in the form of quoted material in cataloging. Conversely, significant differences in the writing style for the same script may be reflected in the bibliographical classification—for example, Fraktur or Gaelic for the Latin script.
Script information is also taken into consideration in collation. The data in the Default Unicode Collation Element Table (DUCET) are grouped by script, so that letters of different script values have different primary sort weights. However, numbers, symbols, and punctuation are not grouped with the letters. For the purposes of ordering, therefore, script is most significant for the letters. For more information, see Unicode Technical Standard #10, “Unicode Collation Algorithm” [UCA].
These examples demonstrate that the definition of script depends on the intended purposes of the classification. Table 1 summarizes some of the purposes for which text elements can be classified by script.
|Document||Bibliographical||Record in which script a text is printed or published; subdivides some scripts—for example, Latin into normal, Fraktur, and Gaelic styles||Unknown
|Character||Graphological/ typographical||Describe to which script a character belongs based on its origin|
|Orthographical||Describe with which script (or scripts) a character is used||Common, Inherited|
|For collation||Group letters by script in collation element table|
|Run||For font binding or search||Determine extent of run of like script in (potentially) mixed-script text|
Bibliographical, graphological, or historical classifications of scripts need different distinctions than the type of text-processing–related needs supported by Unicode script values. The requirements of the task not only affect how fine-grained the classification is, but also what kinds of special values are needed to make the system work. For example, when bibliographers are unable to determine the script of a document, they may classify it using a special value for Unknown. In text processing, the identities of all characters are normally known, but some characters may be shared across scripts or attached to any character, thus requiring special values for Common and Inherited.
Despite these differences, the vast majority of Unicode script values correspond more or less directly to the script identifiers used by bibliographers and others. Unicode script values are therefore mapped to their equivalents in the registry of script identifiers defined by [ISO15924].
Unicode characters are also divided into non-overlapping ranges called blocks [Blocks]. Many of these blocks have the same name as one of the scripts because characters of that script are primarily encoded in that block. However, blocks and scripts differ in the following ways:
As a result, for mechanisms such as regular expressions, using script values produces more meaningful results than simple matches based on block names.
The script values form a full partition of the codespace: every code point is assigned a single script value. This value either a specific script value, such as Cyrillic, or one of the following three special values:
As new scripts are added to the standard, more script values will be added. See Section 3.2, Assignment of Script Values.
A character is assigned a specific Unicode script value (as opposed to Common or Inherited) only when it is clearly not used with other scripts. This facilitates the use of the Script property for common tasks such as regular expressions, but means that some characters that are definite members of a given script by their graphology nevertheless are assigned one of the generic values. As more data on the usage of individual characters is collected, the script value assigned to a character may change. If it becomes established that a character is regularly used with more than one script, it will be assigned the Common value, where previously it would have had a more specific script value. However, the opposite type of change is possible as well.
In determining the boundaries of a run of text in a given script, programs must resolve any of the special script values, such as Common, based on the context of the surrounding characters. A simple heuristic uses the script of the preceding character, which works well in many cases. However, this may not always produce optimal results. For example, in the text “... gamma (γ) is ...”, this heuristic would cause matching parentheses to be in different scripts.
Generally, paired punctuation, such as brackets or quotation marks, belongs to the enclosing or outer level of the text and should therefore match the script of the enclosing text. In addition, opening and closing elements of a pair resolve to the same script values, where possible. The use of quotation marks is language dependent; therefore it is not possible to tell from the character code alone whether a particular quotation mark is used as an opening or closing punctuation. For more information, see Section 6.2, General Punctuation, of [Unicode].
Some characters that are normally used as paired punctuation may also be used singly. An example is U+2019 RIGHT SINGLE QUOTATION MARK, which is also used as apostrophe, in which case it no longer acts as an enclosing punctuation. An example from physics would be <ψ| or |ψ>, where the enclosing punctuation characters may not form consistent pairs.
Implementations that determine the boundaries between characters of given scripts should never break between a nonspacing mark (a character with General_Category value of Mn or Me) and its base character. Thus, for boundary determinations and similar sorts of processing, a nonspacing mark—whatever its script value—should inherit the script value of its base character.
Normally, a nonspacing mark has the Inherited script value to reflect this. However, in cases where the best interpretation of a nonspacing mark in isolation would be a specific script, its script property value may be different from Inherited. For example, the Hebrew marks and accents are used only with Hebrew characters and are therefore assigned the Hebrew script value.
The script property is useful in regular expression syntax for easy specification of spans of text that consist of a single script or mixture of scripts. In general, regular expressions should use specific script values only in conjunction with both Common and Inherited. For example, to distinguish a sequence of characters appropriate for Greek, one would use
((Greek | Common) (Inherited |
Me | Mn)?)*
The preceding expression matches all characters that are either in Greek or in Common and which are optionally followed by characters in Inherited. For completeness, the regular expression also allows any nonspacing or enclosing mark.
Some languages commonly use multiple scripts, so for Japanese one might use
((Hiragana | Katakana | Han | Latin | Common)
(Inherited | Me | Mn)?)*
Note that while it is necessary to include Latin in the preceding expression to ensure that it can cover the typical script use found in many Japanese texts, doing so would make it difficult to isolate a run of Japanese inside an English document, for example. For more information, see Unicode Technical Standard #18, “Unicode Regular Expressions” [RegEx].
The script values form a full partition of the Unicode codespace, but that partition does not exhaust the possibilities for useful and relevant script-like subsets of Unicode characters.
For example, a user might wish to define a regular expression to span typical mathematical expressions, but the subset of Unicode characters used in mathematics does not correspond to any particular script. Instead, it requires use of the Math property, other character properties, and particular subsets of Latin, Greek, and Cyrillic letters. For information on other character properties, see the [UCD].
In texts of an academic, scientific, or engineering nature, the use of isolated Greek characters is common—for example, Ω for ohm; α, β, and γ for types of radioactive decays or in names of chemical compounds; π for 3.1415..., and so on. It is generally undesirable to treat such usage the same as ordinary text in the Greek script. Some commonly used characters, such as µ, already exist twice in the Unicode Standard, but with different script values.
The script property values may also be useful in
providing users feedback to signal possible spoofing, where
visually similar characters (confusable characters) are substituted in
an attempt to mislead a user. For example, a domain name such as
could be spoofed with
macchiatο.com (using U+03BF GREEK LETTER SMALL
LETTER OMICRON for the first “o”)
maссhiato.com (using U+0441 CYRILLIC SMALL LETTER ES for the first
two “c”s). The user can
be alerted to odd cases by displaying mixed scripts with different colors,
highlighting, or boundary marks:
maссhiato.com, for example.
Possible spoofing is not limited to mixtures of scripts. Even in ASCII, there are confusable characters such as 0 and O, or 1 and l. For a more complete approach, the use of script values needs to be augmented with other information such as General_Category values and lists of individual characters that are not distinguished by other Unicode properties. For additional information, see Unicode Technical Report #36, “Unicode Security Considerations” [Security].
Table 2 illustrates some of the script values used in the data file. The short name for the Unicode script value matches the ISO 15924 code. Further subdivisions of scripts by ISO 15924 into varieties are shown in parentheses. For a complete list of values and short names, see the Property Value Aliases [PropValue]. As with all property value aliases, the values in the file are not case sensitive, and the presence of hyphen or underscore is optional. The order in which the scripts are listed here or in the data file is not significant.
|Script Value||ISO 15924|
Although Braille is not a script in the same sense as Latin or Greek, it is given a script value in [Data24]. This is useful for various applications for which these script values are intended, such as matching spans of similar characters in regular expressions.
ISO 15924: Code for the Representation of Names of Scripts [ISO15924] provides an enumeration of four-letter script codes. In the [UCD] file [PropValue], corresponding codes from [ISO15924] are provided as short names for the scripts.
In some cases the match between these script values and the ISO 15924 codes is not precise, because the goals are somewhat different. ISO 15924 is aimed primarily at the bibliographic identification of scripts; consequently, it occasionally identifies varieties of scripts that may be useful for book cataloging, but that are not considered distinct scripts in the Unicode Standard. For example, ISO 15924 has separate script codes for the Fraktur and Gaelic varieties of the Latin script.
Where there are no corresponding ISO 15924 codes, the private-use ones starting with Q are used. Such values are likely to change in the future. In such a case, the Q-names will be retained as aliases in the [PropValue] for backward compatibility.
New characters and scripts are continually added to the Unicode Standard. The following methodology is used to assign script values when new characters are added to the Unicode Standard:
Script values are not immutable. As more data on the usage of individual characters is collected, script values may be reassigned using the above methodology.
The following methodology is used to create names for new scripts added to the Unicode Standard. Script names are limited to
Script names are guaranteed to be unique, even when ignoring case differences and the presence of SPACE or HYPHEN-MINUS. Underscores are not used when assigning script names. Similar restrictions apply to block names.
The Scripts.txt data file is available at [Data24]. The format of the file is similar to that of Blocks.txt [Blocks]. The fields are separated by semicolons. The first field contains either a single code point or the first and last code points in a range separated by “..”. The second field provides the script value for that range. The comment (after a #) indicates the General_Category and the character name. For each range, it gives the character count in square brackets and uses the names for the first and last characters in the range. For example:
0B01; ORIYA # Mn ORIYA SIGN CANDRABINDU 0B02..0B03; ORIYA # Mc  ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA
The value Unknown is the default value, given to all code points that are not explicitly mentioned in the data file.
Mark Davis authored the initial versions. Asmus Freytag has added to and maintains the text of this annex.
Thanks to Ken Whistler and Julie Allen for comments on this annex, including earlier versions.
For references for this annex, see Unicode Standard Annex #41, “Common References for Unicode Standard Annexes.”
For details of the change history, see the online copy of this annex at http://www.unicode.org/reports/tr24/.
The following summarizes modifications from the previous revision of this annex.
Revision 8 being a proposed update, only changes between revisions 9 and 7 are noted here.
Revision 6 being a proposed update, only changes between revisions 7 and 5 are noted here.
Unicode and the Unicode logo are trademarks of Unicode, Inc., and are registered in some jurisdictions.