Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jezza/mutf8
Basic support for mutf8 strings in Rust.
https://github.com/jezza/mutf8
encoding modified-utf8 mutf8 rust string
Last synced: 7 days ago
JSON representation
Basic support for mutf8 strings in Rust.
- Host: GitHub
- URL: https://github.com/jezza/mutf8
- Owner: Jezza
- License: mit
- Created: 2018-12-31T22:25:17.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-18T12:29:06.000Z (almost 4 years ago)
- Last Synced: 2024-10-13T15:13:01.888Z (25 days ago)
- Topics: encoding, modified-utf8, mutf8, rust, string
- Language: Rust
- Size: 22.5 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MUTF-8
## Usage
```rust
fn main() {
let output: Cow = mutf8::utf8_to_mutf8("Hello, \0World");// `output` contains no NUL bytes.
}
```There's also a `MString` and `mstr` struct.
These are the counterparts to `String` and `str` within the standard library.```rust
fn main() {
let data = mstr::from_utf8(b"\0");
assert_eq!(data.len(), 2);
}
```## About
This crate allows converting UTF-8 to and from MUTF-8.Some data formats, such as the JVM classfile, make use of an altered UTF-8 encoding.
This one in particular is the MUTF-8 variant.It allows a NUL byte to be encoded without using the NUL byte itself.
## WIP
The algorithm itself is done, and useable.
It works as well as any other.The reason I still call this crate WIP is because of the two String structs.
I'm not happy with them.I do use this crate for a couple of projects, but _none_ of them make use of the structs themselves.
I typically use this crate as just a jump from a `[u8]` to a `Cow`.
So, until I work out where I want to go with this crate, it's probably going to stay like this.