Skip to main content

Tests

mutf-8

This package contains simple pure-python as well as C encoders and decoders for the MUTF-8 character encoding. In most cases, you can also parse the even-rarer CESU-8.

These days, you'll most likely encounter MUTF-8 when working on files or protocols related to the JVM. Strings in a Java .class file are encoded using MUTF-8, strings passed by the JNI, as well as strings exported by the object serializer.

This library was extracted from Lawu, a Python library for working with JVM class files.

🎉 Installation

Install the package from PyPi:

pip install amulet-mutf8

Binary wheels are available for the following:

py3.6 py3.7 py3.8 py3.9
OS X (x86_64) y y y y
Windows (x86_64) y y y y
Linux (x86_64) y y y y

If binary wheels are not available, it will attempt to build the C extension from source with any C99 compiler. If it could not build, it will fall back to a pure-python version.

Usage

Encoding and decoding is simple:

from mutf8 import encode_modified_utf8, decode_modified_utf8

unicode = decode_modified_utf8(byte_like_object)
bytes = encode_modified_utf8(unicode)

This module does not register itself globally as a codec, since importing should be side-effect-free.

📈 Benchmarks

The C extension is significantly faster - often 20x to 40x faster.

MUTF-8 Decoding

Name Min (μs) Max (μs) StdDev Ops
cmutf8-decode_modified_utf8 0.00009 0.00080 0.00000 9957678.56358
pymutf8-decode_modified_utf8 0.00190 0.06040 0.00000 450455.96019

MUTF-8 Encoding

Name Min (μs) Max (μs) StdDev Ops
cmutf8-encode_modified_utf8 0.00008 0.00151 0.00000 11897361.05101
pymutf8-encode_modified_utf8 0.00180 0.16650 0.00000 474390.98091

C Extension

The C extension is optional. If a binary package is not available, or a C compiler is not present, the pure-python version will be used instead. If you want to ensure you're using the C version, import it directly:

from mutf8.cmutf8 import decode_modified_utf8

decode_modified_utf(b'\xED\xA1\x80\xED\xB0\x80')

Metadata

Release files for amulet-mutf8 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for amulet-mutf8 1.0.7
File Size Uploaded
amulet_mutf8-1.0.7.tar.gz 8.9 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for amulet-mutf8 1.0.7
File
amulet_mutf8-1.0.7-cp314-cp314-win_arm64.whl CPython 3.14 CPython 3.14 Windows ARM64 Details
amulet_mutf8-1.0.7-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
amulet_mutf8-1.0.7-cp314-cp314-macosx_10_15_universal2.whl CPython 3.14 CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64) Details
amulet_mutf8-1.0.7-cp313-cp313-win_arm64.whl CPython 3.13 CPython 3.13 Windows ARM64 Details
amulet_mutf8-1.0.7-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
amulet_mutf8-1.0.7-cp313-cp313-macosx_10_13_universal2.whl CPython 3.13 CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64) Details
amulet_mutf8-1.0.7-cp312-cp312-win_arm64.whl CPython 3.12 CPython 3.12 Windows ARM64 Details
amulet_mutf8-1.0.7-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
amulet_mutf8-1.0.7-cp312-cp312-macosx_10_13_universal2.whl CPython 3.12 CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64) Details
amulet_mutf8-1.0.7-cp311-cp311-win_arm64.whl CPython 3.11 CPython 3.11 Windows ARM64 Details
amulet_mutf8-1.0.7-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
amulet_mutf8-1.0.7-cp311-cp311-macosx_10_9_universal2.whl CPython 3.11 CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) Details

Total release size: 150.8 kB

Release files / amulet_mutf8-1.0.7.tar.gz

Download URL amulet_mutf8-1.0.7.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7e45b1bdfdc33e3bcd8e986956de7a5a404a631937ffb45b87c686b61614bf7f
BLAKE2b-256 checksum
How to use checksums
300cb49bed3ea8ccfc9956d76c422d31ba1bfaf4a0320e6ea9e02dac91f64869
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / amulet_mutf8-1.0.7-cp314-cp314-win_arm64.whl

Download URL amulet_mutf8-1.0.7-cp314-cp314-win_arm64.whl
Size 10.9 kB
Tags CPython 3.14 Windows ARM64
SHA-256 checksum
How to use checksums
9b0bac5dd4f137e3970f65bc8d30f3047552759adf5049ef532d15ffeb509459
BLAKE2b-256 checksum
How to use checksums
f0c836a4aa9136b0147ae65c3cd514f69250f2346aa2aa26389ecbe7be4dc6a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / amulet_mutf8-1.0.7-cp314-cp314-win_amd64.whl

Download URL amulet_mutf8-1.0.7-cp314-cp314-win_amd64.whl
Size 12.1 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
e8c92db39c6be1c82331aa13a2694355fb5735769603aa6dc1f5748daf1bfe5d
BLAKE2b-256 checksum
How to use checksums
b149d3af34f0baa54c810765adb94e08b21f90e335ab4275ce2e9923511ff20e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / amulet_mutf8-1.0.7-cp314-cp314-macosx_10_15_universal2.whl

Download URL amulet_mutf8-1.0.7-cp314-cp314-macosx_10_15_universal2.whl
Size 12.7 kB
Tags CPython 3.14 macOS 10.15+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
f2eb89ae4c1fc8d8c237452b9bf2fb674c1a38ba9e59f363fe719d9693058a3f
BLAKE2b-256 checksum
How to use checksums
f19d1d8a2f992b8eb97bf66e11c16e080f61611bbdd9e763586c5375676a190d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / amulet_mutf8-1.0.7-cp313-cp313-win_arm64.whl

Download URL amulet_mutf8-1.0.7-cp313-cp313-win_arm64.whl
Size 10.8 kB
Tags CPython 3.13 Windows ARM64
SHA-256 checksum
How to use checksums
6498a4f0df85a3e0aa5209453c3a6706fc56dfb55626328c28b3f468ccd539c9
BLAKE2b-256 checksum
How to use checksums
6a0cd956b31041f6a59038bc303af818e713b1d3730733de4d5431f250b3b175
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / amulet_mutf8-1.0.7-cp313-cp313-win_amd64.whl

Download URL amulet_mutf8-1.0.7-cp313-cp313-win_amd64.whl
Size 11.9 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
35c35574367c3689a8234599f07412fd4617039a3d5b160fb4b953bcd06af7ec
BLAKE2b-256 checksum
How to use checksums
c8773fdc23ef4218273c65e5413b22a76bb98a3721b20c464c6d38194aac190a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / amulet_mutf8-1.0.7-cp313-cp313-macosx_10_13_universal2.whl

Download URL amulet_mutf8-1.0.7-cp313-cp313-macosx_10_13_universal2.whl
Size 12.7 kB
Tags CPython 3.13 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
3c088b5d8ebe97166371cb0f48f7c366eb71c0bcfbaa67a5c725ea6ee4dcb45d
BLAKE2b-256 checksum
How to use checksums
664451ae3427dc161ae97b26640eef372c98bfc68ecaa10023519be73ce6a632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / amulet_mutf8-1.0.7-cp312-cp312-win_arm64.whl

Download URL amulet_mutf8-1.0.7-cp312-cp312-win_arm64.whl
Size 10.8 kB
Tags CPython 3.12 Windows ARM64
SHA-256 checksum
How to use checksums
c09fb701d6c7c3679c1696dbde29f821a53091a2bf6082a61ea64ea2b5cacac1
BLAKE2b-256 checksum
How to use checksums
91c589b85170f91837b68cd5567379b37d59fc0fe0e806c15de1ca1e9b677b23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / amulet_mutf8-1.0.7-cp312-cp312-win_amd64.whl

Download URL amulet_mutf8-1.0.7-cp312-cp312-win_amd64.whl
Size 11.9 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
ac0d9c19408bf9803de9ad402c53f9b4192d4a19c8d4053ca23239162998f5f5
BLAKE2b-256 checksum
How to use checksums
a5a178ce6c14d235ce773a5b81ae82eb9a314ae751da55d755c35b65a68725fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / amulet_mutf8-1.0.7-cp312-cp312-macosx_10_13_universal2.whl

Download URL amulet_mutf8-1.0.7-cp312-cp312-macosx_10_13_universal2.whl
Size 12.7 kB
Tags CPython 3.12 macOS 10.13+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
6f77d1cc18525e23f8e1a21e4676d32bee9f4dcbc8c6ddc4d2195380d8e9fc1a
BLAKE2b-256 checksum
How to use checksums
bf2a2253016a16d2163750cffb23ffdfc681f4e336e2428bdd5222cd9464eee7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / amulet_mutf8-1.0.7-cp311-cp311-win_arm64.whl

Download URL amulet_mutf8-1.0.7-cp311-cp311-win_arm64.whl
Size 10.8 kB
Tags CPython 3.11 Windows ARM64
SHA-256 checksum
How to use checksums
413cf14df73095e3c1f8bd5328868e76d4e0ca17ee980df2c2dc519c671fbcbe
BLAKE2b-256 checksum
How to use checksums
35672e1f627737ddb6b9f5cfd9fb714049f3a08beed57ce347263e6bf3c36f62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / amulet_mutf8-1.0.7-cp311-cp311-win_amd64.whl

Download URL amulet_mutf8-1.0.7-cp311-cp311-win_amd64.whl
Size 11.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
0fe1d251c2cbf6d018cda90615c766d4ff7f4f746e77c3c2d29f6a8d38e08977
BLAKE2b-256 checksum
How to use checksums
e7f99defbad74907bad08ad33e7fe11a20445c504fd2924572c275c32a9da39b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / amulet_mutf8-1.0.7-cp311-cp311-macosx_10_9_universal2.whl

Download URL amulet_mutf8-1.0.7-cp311-cp311-macosx_10_9_universal2.whl
Size 12.7 kB
Tags CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
4ce86966d06a68e22bf2de6507dc24740fe7681967b21140ae687cc1f57ca558
BLAKE2b-256 checksum
How to use checksums
115d64837608b628f0b6e0bf0e5748f266b7a17c2e55238d63ec8cf7f657e142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

1.0.7 This release

13 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page