Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to bstr for escaping mostly UTF-8 binary data #150

Merged
merged 1 commit into from
Sep 19, 2023
Merged

Conversation

chenxiaolong
Copy link
Owner

@chenxiaolong chenxiaolong commented Sep 18, 2023

bstr is Unicode-aware and won't split multi-byte codepoints into multiple \x##.

This commit also adds an escape module for use with serde so we can serialize mostly UTF-8 binary data into human-readable files, like TOML.

@chenxiaolong chenxiaolong self-assigned this Sep 18, 2023
@chenxiaolong chenxiaolong force-pushed the escape branch 2 times, most recently from 7baf729 to 149aad4 Compare September 18, 2023 22:08
@chenxiaolong
Copy link
Owner Author

I'm going to switch to using the bstr crate for doing the escaping instead. It's Unicode-aware and encodes foobar你好<ff byte> as foobar你好\xff instead of foobar\xe4\xbd\xa0\xe5\xa5\xbd\xff. Since avbroot uses escaping to show (mostly UTF-8) binary data as human readable as possible, having Unicode support is good.

bstr is Unicode-aware and won't split multi-byte codepoints into
multiple `\x##`.

This commit also adds an `escape` module for use with serde so we can
serialize mostly UTF-8 binary data into human-readable files, like TOML.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
@chenxiaolong chenxiaolong changed the title Improve escaped string API and add decoder for it Switch to bstr for escaping mostly UTF-8 binary data Sep 19, 2023
@chenxiaolong chenxiaolong merged commit a582d0b into master Sep 19, 2023
@chenxiaolong chenxiaolong deleted the escape branch September 19, 2023 01:25
chenxiaolong added a commit that referenced this pull request Sep 19, 2023
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant