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
Built Distribution
File details
Details for the file hkscs-unicode-converter-1.0.0.tar.gz
.
File metadata
- Download URL: hkscs-unicode-converter-1.0.0.tar.gz
- Upload date:
- Size: 536.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32de9abf1618597ba39ffb8a2d0f32547e1345204d4d31d562905797237e5bf4 |
|
MD5 | d2a5261bbffeec248995b1fd39893081 |
|
BLAKE2b-256 | accbd4c79fcf1c4753897991707f7a92dcca9a2bd535143e4527d32b14dfa179 |
File details
Details for the file hkscs_unicode_converter-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: hkscs_unicode_converter-1.0.0-py3-none-any.whl
- Upload date:
- Size: 541.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c75cd3de5b2cc3aa747f0431f86b7810912366be02c0352a8da7a140cba176d2 |
|
MD5 | ac91be5e971be4acc31a6dda4acd3710 |
|
BLAKE2b-256 | 05287580bdea501a494213d62b688cd57c9c1c31237f6906ddfba655d35a6ab5 |