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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for hkscs-unicode-converter-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 580d08b8c7be992d7e7d602802279ce6f9ad23e7593d10faa84b3512b4c98495 |
|
MD5 | e928a935331508f3c2c693d2887cd88f |
|
BLAKE2b-256 | 9baf865c700bfa78a9c92536759ce7fd34247ead63a05e7c72e0bb1f2682e790 |
Close
Hashes for hkscs_unicode_converter-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1c78d1ef84711e11d9c67f01c505742ce0bccfef12a2f25972c18189bc5a9af |
|
MD5 | 30fafce7e8fb0f48f04553e016472ab6 |
|
BLAKE2b-256 | 42b3232c8a55c6eaafd5111c6342303b69bed4f846cc22b730bc9449b554a12b |