Module:Unicode data/documentation

This module is used for accessing the Unicode character database (version 15.1), derived from files in the Unicode Character Database (UCD).

Functions
All of these functions can only be used in a module. For template-invokable functions, see Module:Unicode data/templates.
 * Look up the name of a code point. Used by Module:character info, Module:character list, Module:also, and Module:mul-domino def.
 * Look up the name of a code point. Used by Module:character info, Module:character list, Module:also, and Module:mul-domino def.


 * Look up the image for a code point. Used by Module:character info and Module:character list.
 * Look up the image for a code point. Used by Module:character info and Module:character list.


 * Used in a lua loop in Module:character list to iterate through the array of block ranges.
 * Used in a lua loop in Module:character list to iterate through the array of block ranges.


 * lua
 * Returns the name of the plane to which a code point belongs. Unused.


 * lua
 * Given a block name, returns the range of code points included in the block. Used by Module:character list.


 * lua
 * Given a string, returns lua or lua depending on whether the string can be used as a page title.


 * lua
 * Given a string, places a dotted circle before every combining character in the string. Used by Module:grc-utilities.


 * lua
 * Given a code point, returns the Unicode script code, using Module:Unicode data/scripts.


 * lua
 * Returns the title for the entry on a character, which is a subpage of Unsupported titles for characters that cannot appear in pagenames. See Manual:Page title on the MediaWiki website for more information. Used by Module:character info and Module:character list.

The following functions relate to a code point's. They receive a code point and return two values: a boolean (which expresses whether the code point fulfills the condition) and a string describing the General Category, if the character is in the General Categories of Separator (Z) or Other (C), or the string lua. They use Module:Unicode data/control.
 * lua
 * Checks whether a code point's General Category is not Cn (Other, unassigned). Used by Module:character list.


 * lua
 * Checks whether a code point is printable: that its General Category is not "Other" (C), "Separator, line" (Zl), or "Separator, paragraph" (Zp). Used by Module:character info and Module:character list.


 * lua
 * Checks whether a code point's General Category is Zs ("Separator, space"). Used by Module:character list and Module:links/print data.

Data modules
The data used by functions in this module is found on subpages.
 * Module:Unicode data/aliases: the formal name aliases for characters (from NameAliases.txt)
 * Module:Unicode data/blocks: the list of Unicode blocks (from Blocks.txt); currently used by Module:Unicode data/sandbox
 * Module:Unicode data/category: data mapping characters to their General Category (from DerivedGeneralCategory.txt)
 * Module:Unicode data/control: data for identifying characters that belong to the General Categories of Separator and Other (from DerivedGeneralCategory.txt)
 * Module:Unicode data/combining: data mapping characters to their Combining Classes (from DerivedCombiningClass.txt)
 * Module:Unicode data/Hangul: data used to generate the names of Hangul syllables (from Jamo.txt)
 * Module:Unicode data/scripts: data mapping characters to Unicode script property (from Scripts.txt)

The name and image data modules (Module:Unicode data/names/ xxx and Module:Unicode data/images/ xxx ) were compiled from UnicodeData.txt. Each one contains, at maximum, code points U+xxx000 to U+xxxFFF. The names in the following ranges, however, are auto-generated by this base module and do not require separate name modules:
 * BMP: 0000–001F (C0 control characters), 007F–009F (DEL and C1 control characters), 3400–4DBF (CJK),
 * 4E00–9FFF (CJK), AC00–D7A3 (Hangul), D800–DFFF (surrogates), E000–F8FF (private use), F900–FAFF (CJK)
 * SMP: 17000–18AFF (Tangut), 18B00–18CD5 (Khitan), 18D00–18D08 (Tangut), 1B170–1B2FB (Nüshu)
 * Planes 2–3 (CJK)
 * Plane 14: E0100–E01EF (variation selectors)
 * Planes 15–16 (private use)

Updating
When each Unicode version is released, several submodules, and sometimes the name rules in the main module, need to be updated. The name, block, control character, and combining character category modules were constructed by the scripts given in User:Kephir/Unicode; the script and General Category modules were generated by modules on Wikipedia. Most of the name rules are given in chapter 4, section 4.8 (Name) of the Unicode Core Specification, others were manually added and at each Unicode version the ranges of characters that they apply to may need to be expanded.

Module:Unicode data/Hangul and the Hangul Syllable name rule never need to be updated.

After these modules have been updated, the version number in Module:character list needs to be updated as well.

Copyright
The Unicode database is released by Unicode Inc. under the following terms:

Copyright © 1991-2022 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in https://www.unicode.org/copyright.html.

Permission is hereby granted, free of charge, to any person obtaining a copy of the Unicode data files and any associated documentation (the "Data Files") or Unicode software and any associated documentation (the "Software") to deal in the Data Files or Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Data Files or Software, and to permit persons to whom the Data Files or Software are furnished to do so, provided that either (a) this copyright and permission notice appear with all copies of the Data Files or Software, or (b) this copyright and permission notice appear in associated Documentation.

THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in these Data Files or Software without prior written authorization of the copyright holder.