This package provides fast pure-Python and optional C implementations for encoding and decoding MUTF-8 and CESU-8 character encodings. MUTF-8 is a variant of UTF-8 primarily encountered in Java Virtual Machine (JVM) contexts. It offers significant performance gains with its C extension, falling back to a pure-Python version if the C extension cannot be built. The current version is 1.0.6, released in late 2021, and the project is in a maintenance phase.
pip install mutf8Verified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to encode a Python string (including one with a null character) into MUTF-8 bytes and then decode it back using the `mutf8` library. MUTF-8 handles null characters and supplementary characters differently than standard UTF-8.
Always use `mutf8.encode_modified_utf8` and `mutf8.decode_modified_utf8` when working with MUTF-8 encoded data, especially when interfacing with Java systems.
Ensure a C99-compatible compiler is installed and available in your environment before installing `mutf8` to leverage the performance benefits of the C extension. Check installation logs for successful C extension compilation.
Upgrade to `mutf8` version `1.0.3` or newer to benefit from improved error reporting and more accurate error locations in `UnicodeDecodeErrors`.
Upgrade your Python environment to version 3.6 or newer to continue using `mutf8`.
Ensure the input data is genuinely MUTF-8 encoded. If dealing with Java systems, verify the MUTF-8 encoding process. If using an older `mutf8` version, upgrade to 1.0.3 or newer for improved error reporting. Carefully inspect the bytes around the reported position to identify the malformed sequence.
Verify the integrity and completeness of the MUTF-8 byte sequence being decoded. This error often points to truncated or severely malformed input that causes the decoder to expect more bytes than are available in a sequence.
Ensure a C99-compatible compiler (like GCC or MSVC) is installed and available in your environment before installing `mutf8`. Then, reinstall the library using `pip install --no-binary :all: mutf8` to force a source build, or simply `pip install mutf8` after confirming your compiler setup. If the C extension is not critical for your use case, you can continue using the pure-Python fallback by importing directly from `mutf8` (e.g., `from mutf8 import encode_modified_utf8`).
No dependency data recorded yet.