bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Corrupted multibyte characters in command substitutions fixes may be


From: Greg Wooledge
Subject: Re: Corrupted multibyte characters in command substitutions fixes may be worse than problem.
Date: Sun, 6 Feb 2022 18:01:03 -0500

On Sun, Feb 06, 2022 at 11:11:43PM +0100, Alex fxmbsw7 Ratchev wrote:
> [[ Regarding nul bytes discarded by command substitution ]]
> can't these \0 bytes be encoded at least when a utf8 locale is used as
> \u0 instead of dropping ? <the two utf 8 bytes> and a null, ... just
> prefix the utf 8 encoding chars to the null
> and they'd be safely maybe still here

There are other programming languages besides bash.  Some of them can
store NUL bytes internally, either by encoding and decoding them on the
fly, or by not using C-style strings internally (which means any system
calls require encoding/decoding the internal strings to C-style strings).

I urge you to learn one of these other languages, and use it.

Bash is a shell, not a full general-purpose programming language.  It's
not suited to all tasks.  Many other languages are *better* suited to
various tasks.  Using the best language for each task will make your
life easier.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]