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

echo, printf: UTF-8 sensitivity in arguments #6804

Open
andrewliebenow opened this issue Oct 20, 2024 · 1 comment
Open

echo, printf: UTF-8 sensitivity in arguments #6804

andrewliebenow opened this issue Oct 20, 2024 · 1 comment

Comments

@andrewliebenow
Copy link
Contributor

❯ coreutils echo "$(coreutils printf 'A \xFF Z')"
error: invalid UTF-8 was detected in one or more arguments

Usage: coreutils echo [OPTIONS]... [STRING]...

For more information, try '--help'.

❯ /usr/bin/echo "$(coreutils printf 'A \xFF Z')"
A � Z
❯ coreutils printf "$(coreutils printf 'A \xFF Z')\n"
error: invalid UTF-8 was detected in one or more arguments

Usage: coreutils printf FORMATSTRING [ARGUMENT]...
       coreutils printf FORMAT [ARGUMENT]...
       coreutils printf OPTION

For more information, try '--help'.

❯ /usr/bin/printf "$(coreutils printf 'A \xFF Z')\n"
A � Z

I'm not sure if this is practically relevant. You can't print arbitrary binary data with echo/printf anyway, because the arguments are C strings (null terminated).

@andrewliebenow
Copy link
Contributor Author

Fixed in echo by #6803
Not yet fixed in printf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants