Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tinyunicodeblock

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinyunicodeblock

A tiny utility to get the Unicode block of a character

  • 1.3
  • PyPI
  • Socket score

Maintainers
1

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc