UTF-16K
Unlimited UTF-16! UTF-16 ⊆ UTF-16K.
- UTF-16K is a way to expand UTF-16 indefinitely without breaking UTF-16's existing syntax.
- This repository contains a Python implementation of UTF-16K.
- See UTF-8000-Website for the full writeup of UTF-8K and UTF-16K.
- UTF-16K is in no way endorsed by or representative of the Unicode Consortium. This is a standalone project.
Installing
Available on PyPI as UTF-16K
Recommended install using pipx:
$ pipx install UTF-16K
provides
utf-16k(1)
with subcommands
utf-16k info
utf-16k encode
utf-16k decode
TLDR Examples
Using utf-16k info
Color key:
- Bright Yellow: UTF-16 surrogate frame
110110(high) or110111(low) - Bright Red: upper 4 or 3 content bits of high surrogates, for UTF-16 the Unicode Plane indicator bits, for UTF-16K the bits '100' that indicate Planes 9 and 10
- Bright Cyan: UTF-16K self-synchronization bit
0or1 - Bright Magenta: UTF-16K self-punctuation bits
111...110 - Bright Green: mandatory content bits (nb 4-word UTF-16K works slightly differently)
- Green: content bits
Using utf-16k encode
$ echo 'U+DEADBEEFBADF00D' | utf-16k encode | hexdump -C
00000000 da 33 dd ea da 76 df ee da 7e df ad da 7c dc 0d |.3...v...~...|..|
00000010
Using utf-16k decode
Using the bytes from the encode example above
$ echo -ne '\xda\x33\xdd\xea\xda\x76\xdf\xee\xda\x7e\xdf\xad\xda\x7c\xdc\x0d' | utf-16k decode
U+DEADBEEFBADF00D | | da33 ddea da76 dfee da7e dfad da7c dc0d | 1101101000110011 1101110111101010 ...
Package Contents
- encode.py
encode(x: int) -> tuple[int]: Encode an unsigned integer in UTF-16K and return the words.
- decode.py
UTF16KIncrementalDecoder: A 'fancy' incremental decoder class that can be fed words, and can be iterated over, yieldingUTF16KInts when full code units have been supplied and decoded.
- UTF16KInt.py
- A wrapper around
UTF16KWords that form a code unit.
- A wrapper around
- UTF16KWord.py
UTF16KWord: a 'fancy' wrapper around UTF-16K words that is useful for education and inspection.- Various constants and utility functions.
See Also
- UTF-8K
- UTF-8000-Website, the main UTF-8000 specification for UTF-8K and UTF-16K, hosted at utf-8000.jb2170.com
Metadata
Release files for UTF-16K 3.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| utf_16k-3.3.0.tar.gz | 27.7 kB | Without provenance | Details for utf_16k-3.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| utf_16k-3.3.0-py3-none-any.whl | Python 3 | none | any | Details for utf_16k-3.3.0-py3-none-any.whl |
Total release size: 57.3 kB
Release files / utf_16k-3.3.0.tar.gz
| Download URL | utf_16k-3.3.0.tar.gz |
|---|---|
| Size | 27.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c472f6f9b2193f1c59b3c44eee1b49d28d3aa5f8bedd5fc340fb86d4e11d066
|
|
BLAKE2b-256 checksum How to use checksums |
eacd7ef38763e4360eabaa22f6a177ecbc177d04edf868b1d93efcee3211f40e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / utf_16k-3.3.0-py3-none-any.whl
| Download URL | utf_16k-3.3.0-py3-none-any.whl |
|---|---|
| Size | 29.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dca5662ac7ae488d8a38c40df1e9f7819c649cee4f45014d12c0fddf76eca97b
|
|
BLAKE2b-256 checksum How to use checksums |
4720a41d9047db1c43c7de2e1aba52af64d44a94df8235968b338d07c7577f6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Security for UTF-16K 3.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.