skillfed

mutf8

Fast MUTF-8 encoder & decoder

mutf8 v1.1.0 2.1M downloads/30d#3,309 on PyPI12
Permissive license MIT Active released

What it is and what it does

mutf8 is a codec library for Modified UTF-8, the variant used by the Java Virtual Machine for encoding strings in class files, JNI interfaces, and object serialization. It provides both a C extension and a pure-Python fallback, allowing developers to encode Unicode strings to MUTF-8 bytes and decode MUTF-8 bytes back to Unicode. The library does not register itself as a global codec, keeping imports side-effect-free.

The C extension is significantly faster than the pure-Python version, with speedups ranging from around 10× on tiny strings to over 1000× on large ASCII payloads. The package supports Python 3.9 through 3.14 and is distributed as prebuilt wheels for most platforms, minimizing installation friction.

Use it for:

  • Parse and manipulate Java .class files by decoding MUTF-8 strings embedded in the bytecode.
  • Handle string data passed through JNI (Java Native Interface) boundaries in Python-Java interoperability.
  • Deserialize objects exported by Java's object serialization format, which uses MUTF-8 for string encoding.
  • Build tools or analyzers that work with JVM bytecode or class file metadata.
  • Implement protocol handlers that communicate with Java systems using MUTF-8-encoded strings.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Encodes and decodes MUTF-8 (Modified UTF-8), a variant used in Java class files and JNI, with both C and pure-Python implementations.

Yes, if you work with JVM artifacts or JNI. The package is actively maintained, has no known vulnerabilities, and offers both performance (C extension) and portability (pure-Python fallback). Install friction is moderate but manageable via prebuilt wheels. MIT license carries no restrictions.

Install

mutf8 on PyPI

pip

pip install mutf8

uv

uv add mutf8

poetry

poetry add mutf8

Installing mutf8

Before you install

Medium install friction due to C extension compilation, but prebuilt wheels are available for Python 3.9–3.14 on common platforms (macOS, Linux, Windows). Package is actively maintained with a recent release.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.

Quickstart

pip install mutf8

from mutf8 import encode_modified_utf8, decode_modified_utf8

unicode = decode_modified_utf8(b'\xED\xA1\x80\xED\xB0\x80')
bytes_out = encode_modified_utf8(unicode)

Requires Python 3.9 or later; C extension is optional and falls back to pure-Python if compilation fails.

Verify before relying

  • Whether the pure-Python fallback is automatically selected on all platforms where C compilation is unavailable.
  • Performance characteristics of the pure-Python implementation on real-world payloads outside the benchmark scenarios.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 35 days since the last release
Last repo commit
First released
Downloads 2,078,907/month — #3,309 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: mutf8-1.1.0-cp310-cp310-macosx_10_9_x86_64.whl; mutf8-1.1.0-cp310-cp310-macosx_11_0_arm64.whl; mutf8-1.1.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; mutf8-1.1.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; mutf8-1.1.0-cp310-cp310-musllinux_1_2_aarch64.whl; mutf8-1.1.0-cp310-cp310-musllinux_1_2_x86_64.whl; mutf8-1.1.0-cp310-cp310-win32.whl; mutf8-1.1.0-cp310-cp310-win_amd64.whl; mutf8-1.1.0-cp311-cp311-macosx_11_0_arm64.whl; mutf8-1.1.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; mutf8-1.1.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; mutf8-1.1.0-cp311-cp311-musllinux_1_2_aarch64.whl; mutf8-1.1.0-cp311-cp311-musllinux_1_2_x86_64.whl; mutf8-1.1.0-cp311-cp311-win32.whl; mutf8-1.1.0-cp311-cp311-win_amd64.whl; mutf8-1.1.0-cp312-cp312-macosx_11_0_arm64.whl; mutf8-1.1.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; mutf8-1.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; mutf8-1.1.0-cp312-cp312-musllinux_1_2_aarch64.whl; mutf8-1.1.0-cp312-cp312-musllinux_1_2_x86_64.whl

Keywords: mutf-8, cesu-8, jvm

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: CProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries :: Python Modules

Tags

mutf-8 encoder decoderjava class file encodingjni string encodingmodified utf-8 pythonjvm string serializationcesu-8 alternativejava bytecode strings
jvm-interopcharacter-encodingjava-bytecode

More Python Modules packages