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

Add various encoding crates #97

Open
FeldrinH opened this issue Sep 1, 2023 · 6 comments
Open

Add various encoding crates #97

FeldrinH opened this issue Sep 1, 2023 · 6 comments

Comments

@FeldrinH
Copy link

FeldrinH commented Sep 1, 2023

One fairly common usecase that doesn't seem to be covered by crates on blessed.rs is encoding text and binary data.
In particular I think there are two main cases:

  • Encoding strings with a non-UTF8 encoding
    • UTF8 encoding is well supported by the standard library, but for other encodings you need an external library. The main choice for this seems to be encoding_rs.
  • Encoding binary data to string. In particular the two common cases here are hex and base64.
    • For hex there is the crate hex. This crate hasn't had a release in 2 years and there are a number of unmerged pull requests. I don't know if this is a cause for concern or not.
    • For base64 there is base64.
    • Another popular one seems to be data-encoding, which supports hex, base64 and a few other encodings.

It would be nice if at least some more stable and well maintained encoding crates could be added to blessed.rs, especially since encoding is an area where both performance and correctness are important, so you would want to prefer crates that have been vetted by the community.

@djc
Copy link
Contributor

djc commented Sep 1, 2023

I agree that all of these are popular and thus deserving of a mention. I'm personally not a fan of recent developments in the API of the base64 crate (and I know I'm not the only one), so maybe its mention should be qualified somehow.

@FeldrinH
Copy link
Author

FeldrinH commented Sep 1, 2023

I'm personally not a fan of recent developments in the API of the base64 crate (and I know I'm not the only one), so maybe its mention should be qualified somehow.

I hadn't heard of this. I presume you are referring to either marshallpierce/rust-base64#205 or marshallpierce/rust-base64#213 or maybe both.

@djc
Copy link
Contributor

djc commented Sep 1, 2023

The former in particular, and IIRC there were more issues raised after that.

@BurntSushi
Copy link

If encoding_rs is included, please be sure to mention that its scope is fairly strictly restricted to the WHATWG Encoding Standard, which is focused on the web. (And this is totally fine, but some folks might find some holes in the library surprising if they don't know about its scope.)

@paulgb
Copy link

paulgb commented Oct 18, 2023

+1 for data_encoding over base64. It supports base64 and has a cleaner API.

@FeldrinH
Copy link
Author

If encoding_rs is included, please be sure to mention that its scope is fairly strictly restricted to the WHATWG Encoding Standard, which is focused on the web. (And this is totally fine, but some folks might find some holes in the library surprising if they don't know about its scope.)

On that note: Is there a viable alternative for encoding_rs if you need text encodings not included under the WHATWG standard? I couldn't find anything with a few quick google searches.

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

No branches or pull requests

4 participants