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 unescape_ascii fn #169

Closed
leighmcculloch opened this issue Oct 23, 2023 · 4 comments
Closed

Add unescape_ascii fn #169

leighmcculloch opened this issue Oct 23, 2023 · 4 comments
Labels
wontfix This will not be worked on

Comments

@leighmcculloch
Copy link

The bstr crate has an escape_ascii function on Bstr which is really helpful for producing a string version of a Bstr that can be printed, or placed in places that only ascii can be used.

It'd be helpful if there was an unescape_ascii function for producing a [u8]/Bstr from the escaped string produced by escape_ascii.

Then it would be possible to round-trip Bstr into places only ascii strings can be passed.

@leighmcculloch leighmcculloch changed the title Unescape ascii Add unescape_ascii fn Oct 23, 2023
@BurntSushi
Copy link
Owner

Can you link to the escape_ascii method that's in this crate that you're talking about?

@leighmcculloch
Copy link
Author

https://docs.rs/bstr/latest/bstr/struct.BStr.html#method.escape_ascii

Although I realize now that is coming from the core lib. 😳

@BurntSushi
Copy link
Owner

Correct. It's not a method in this library. This library does have escape_bytes and unescape_bytes, though it doesn't limit itself to ASCII.

Otherwise your use case sounds more like something that is a bit niche and might be deserving of something bespoke on your end.

@BurntSushi BurntSushi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2023
@BurntSushi BurntSushi added the wontfix This will not be worked on label Oct 24, 2023
@leighmcculloch
Copy link
Author

leighmcculloch commented Oct 24, 2023

As it turns out escape_bytes is exactly what I was looking for. Thanks. And thanks for making this crate ♥️.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants