Look up Unicode character name or code point label and search in Unicode character names
Unicode characters have names that serve as unique identifiers for each character. The character names in the Unicode Standard are identical to those of ISO/IEC 10646.
The unicode-charnames package performs searches for Unicode character names or code point labels by Unicode character, and searches for Unicode code points by character names. It also performs substring searches in Unicode character names. This package supports version 14.0 of the Unicode Standard (144,697 characters).
The generic term “character name” refers to the Unicode character “Name” property value for an encoded Unicode character. For code points that do not have character names (unassigned, reserved code points and other special code point types), the Unicode Standard uses constructed Unicode code point labels, displayed between angle brackets, to stand in for character names.
pip install unicode-charnames
The library provides:
- A function to get the character name (the normative character property “Name”) or the code point label (for characters that do not have character names) of a single Unicode character.
- A function to get the code point value (in the usual 4- to 6-digit hexadecimal format) corresponding to a Unicode character name; the search is case-sensitive and requires exact string match.
- A function to search characters by character name; the search is case-insensitive but requires exact substring match.
from unicode_charnames import charname, codepoint, search_charnames # charname for char in '龠💓\u00E5\u0002': print(charname(char)) # Output: # CJK UNIFIED IDEOGRAPH-9FA0 # BEATING HEART # LATIN SMALL LETTER A WITH RING ABOVE # <control-0002> # codepoint names = [ 'LATIN CAPITAL LETTER E WITH ACUTE', 'SQUARE ERA NAME REIWA', 'SUPERCALIFRAGILISTICEXPIALIDOCIOUS' ] for name in names: print(codepoint(name)) # Output: # 00C9 # 32FF # None # search_charnames for x in search_charnames('break'): print('\t'.join(x)) # Output: # 00A0 NO-BREAK SPACE # 2011 NON-BREAKING HYPHEN # 202F NARROW NO-BREAK SPACE # 4DEA HEXAGRAM FOR BREAKTHROUGH # FEFF ZERO WIDTH NO-BREAK SPACE
unicode-charnames is released under an MIT license. The full text of the license is available here.
The Unicode Standard “DerivedName.txt” file is licensed under the Unicode License Agreement for Data Files and Software. Please consult the UNICODE, INC. LICENSE AGREEMENT prior to use.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size unicode_charnames-14.0.0.tar.gz (276.6 kB)||File type Source||Python version None||Upload date||Hashes View|