Skip to main content

tinyunicodeblock

A tiny utility to get the Unicode block of a character

Code style Pylint License PyPi Pipeline status

This module provides only one ability that is absent from the built-in module unicodedata.
It contains one function, block(), which returns the name of a Unicode block that a character belongs to.

You may also access basic Unicode block information by getting items from BLOCKS_BYNAME.

Table of contents


📦 Installation

tinyunicodeblock is available on PyPi. It requires a Python version of at least 3.7.0. and depends on no packages.

To install with pip:

python -m pip install tinyunicodeblock

To install through Git:

python -m pip install git+https://gitlab.com/whoatemybutter/tinyunicodeblock.git

🛠 Usage

Only one function is publicly available, block(character). It will return the name of a Unicode block that character belongs to.

Block ranges are also available in the BLOCKS_BYNAME dictionary.

>>> import tinyunicodeblock
>>> tinyunicodeblock.block("a")
'Basic Latin'
>>> tinyunicodeblock.block("\ufdfd")
'Arabic Presentation Forms-A'
>>> tinyunicodeblock.block("\ue845")
'Private Use Area'
>>> tinyunicodeblock.BLOCKS_BYNAME["Basic Latin"]
(0, 127)

CSUR Support

Since v1.2, tinyunicodeblocks contains support for the ConScript Unicode Registry (CSUR).

It is available through the variables CSUR and CSUR_BYNAME. The function block() will optionally include CSUR blocks in its results if the argument include_csur=True is passed to it.

>>> tinyunicodeblock.block("\ue845", include_csur=True)
'Dni'
>>> tinyunicodeblock.block("\ue400", include_csur=True)
'Niskloz'
>>> tinyunicodeblock.block("\uf800", include_csur=True)
'Private Use Area'

tinyunicodeblocks does not contain support for the Under-ConScript Unicode Registry (UCSUR).


📰 Changelog

The changelog is at CHANGELOG.md.


📜 License

tinyunicodeblock v1.2 and above is licensed under MIT.

tinyunicodeblock v1.1 and below is licensed under GNU General Public License 3.0 or later.

Metadata

Release files for tinyunicodeblock 1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tinyunicodeblock 1.3
File Size Uploaded
tinyunicodeblock-1.3.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tinyunicodeblock 1.3
File Interpreter ABI Platform
tinyunicodeblock-1.3-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / tinyunicodeblock-1.3.tar.gz

Download URL tinyunicodeblock-1.3.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cc305f81e3bac4f97b5e3c034a65577ca5ed18be00fd3abb9b31b697c341c9cb
BLAKE2b-256 checksum
How to use checksums
9818205ae2342d900ed5b99323323d06d99ff28067842a7fe1151fbd405cc237
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / tinyunicodeblock-1.3-py3-none-any.whl

Download URL tinyunicodeblock-1.3-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
07edc5f9bdc9e8ee61080c28a453ada50a476caef139c83d0f0209b4f6384fe0
BLAKE2b-256 checksum
How to use checksums
dcc93e772f3d3dda90f2e6b69763b8a6325401de5c19aef2888a3d28ac5fa714
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

1.3 This release

2 release files

1.2

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page