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

Option for 7-bit ASCII output regardless of input type #22

Open
allenap opened this issue Jul 11, 2024 · 0 comments
Open

Option for 7-bit ASCII output regardless of input type #22

allenap opened this issue Jul 11, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@allenap
Copy link
Owner

allenap commented Jul 11, 2024

I've had an unwritten goal to always produce 7-bit ASCII.

Recent changes to Sh have unavoidably broken that because Dash has no escape syntax for high bytes. Pure binary data quoted/escaped by Sh must still be treated as (mostly) pure binary data – it is not safe to convert quoted output produced by Sh into &str or String for example – but the quoted output from Bash or Fish is safe to treat as text; it's always UTF-8.

Indeed, recent changes in #21 have also broken the 7-bit ASCII rule for Bash and Fish because UTF-8 for code points of U+0080 and above is copied verbatim into the output. It's possible to stick to 7-bit ASCII by encoding text into a byte-like form, like &[u8], before quoting, but this API has a sense of indirectness, action at a distance.

It could be useful to have an option to ask for 7-bit ASCII output regardless of the input.

In any case, this crate should state the 7-bit ASCII goal explicitly in documentation, and back it up with explicit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant