Jump to content

Module:Unicode data/documentation

From Wiktionary, the free dictionary
Documentation for Module:Unicode data. [edit]
This page contains usage information, categories, interwiki links and other content describing the module.

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

Functions

[edit]

All of these functions can only be used in a module. For template-invokable functions, see Module:Unicode data/templates.

lookup_name
Look up the name of a code point. Used by Module:character info, Module:character list, Module:also, and Module:mul-domino def.
lookup_image
Look up the image for a code point. Used by Module:character info and Module:character list.
enum_blocks
Used in a for in loop in Module:character list to iterate through the array of block ranges.
lookup_plane
Returns the name of the plane to which a code point belongs. Unused.
get_block_range
Given a block name, returns the range of code points included in the block. Used by Module:character list.
is_valid_pagename
Given a string, returns true or false depending on whether the string can be used as a page title.
add_dotted_circle
Given a string, places a dotted circle before every combining character in the string. Used by Module:grc-utilities.
lookup_script
Given a code point, returns the Unicode script code, using Module:Unicode data/scripts.
get_entry_title
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 General Category. 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 "assigned". They use Module:Unicode data/control.

is_assigned
Checks whether a code point's General Category is not Cn (Other, unassigned). Used by Module:character list.
is_printable
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.
is_whitespace
Checks whether a code point's General Category is Zs ("Separator, space"). Used by Module:character list and Module:links/print data.

Data modules

[edit]

The data used by functions in this module is found on subpages.

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)
Unicode name and image modules,
organized by first three digits of codepoint in hexadecimal base
0 1 2 3 4 5 6 7 8 9 A B C D E F
00x names names names names names           names     names   names
images images images images images images images images images images images images images images   images
emoji images   emoji images emoji images                        
01x names names names names names   names       names names names names names names
images images images images images   images images images   images images images images images images
                              emoji images
02x                                
images images images images images images images images images images images images images images images images
                               
03x                                
images images images                          
                               

Updating

[edit]

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.

[edit]

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.