]> granicus.if.org Git - procps-ng/commit
library: let's make 'escaped_copy' multibyte aware too
authorJim Warner <james.warner@comcast.net>
Thu, 31 Dec 2020 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@dropbear.xyz>
Sat, 2 Jan 2021 04:40:02 +0000 (15:40 +1100)
commit0d386260b4b007e65172d137924db6e4e4e994cd
tree957e6f6de24b40e7c1625e4ce226ea0c01f4691c
parenteea5626bb144328eb60e9ea8a29bd5b1f100ecd9
library: let's make 'escaped_copy' multibyte aware too

This patch is intended to bring the master branch into
closer alignment with the newlib branch functionality.

The commit shown below replaced that 'escape_str' with
'escaped_copy' so that the ps program wouldn't execute
some code twice. However, it created a problem for the
top program when the UTF-8 encoding was not available.

Unlike ps who calls the escape functions directly, top
outputs those library provided strings unaltered. That
means there is no workaround (like LANG=) when such an
encoding was unavailable. This, in turn, can lead to a
corrupted display (especially with the linux console).

Now, when a UTF-8 encoding is not available, multibyte
chars are converted to '?', reducing display problems.

[ there's still a potential problem concerning 'cmd' ]
[ should program names contain multibyte characters. ]
[ unlike that newlib branch, this string is not ever ]
[ altered with the '?' char under the master branch. ]

Reference(s);
. Dec 2020, escaoed_copy repleced most escape_str
commit eea5626bb144328eb60e9ea8a29bd5b1f100ecd9

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/escape.c