Skip to main content

Convert HKSCS codepoints to corresponding new codepoints in Unicode 4.1 onwards

Project description

hkscs-unicode-converter

hkscs-unicode-converter is a utility for converting HKSCS characters assigned to Private Use Areas of Unicode to their equivalents in Unicode 4.1 onwards. Inspired by the npm module of the same name.

>>> from hkscs_unicode_converter import converter
>>> converter.convert_string("亂廿四") # Convert an entire string
'亂噏廿四'
>>> converter.convert_char("") # Convert a single character
'嘅'
>>> converter.convert_char(chr(0xE7D4)) # Convert from codepoint
'啱'
>>> converter.convert_char("\uE7D4") # Convert from Unicode literal
'啱'
>>> hex(ord(converter.convert_char(chr(0xE7D4)))) # Get corresponding codepoint
'0x5571'

Installing

hkscs-unicode-converter is available on PyPI and officially supports Python 3.7+:

$ python3 -m pip install hkscs-unicode-converter

Tests

Tests are located in the hkscs_unicode_converter submodule. Testing uses tox to automate environment management and the built-in unittest framework to run tests.

$ tox

Style Guide

Run black before committing to master!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hkscs-unicode-converter-1.1.0.tar.gz (557.5 kB view hashes)

Uploaded Source

Built Distribution

hkscs_unicode_converter-1.1.0-py3-none-any.whl (561.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page