Was Re: Ping - pstree + minor patch

Nuno Lucas ntlucas at gmail.com
Mon Dec 6 20:26:08 UTC 2010


On Mon, Dec 6, 2010 at 17:07, Cathey, Jim <jcathey at ciena.com> wrote:
>> > > -         } else if (*here >= ' ' && *here <= '~') {
>> > > +         } else if (*here >= ' ' && *here < 0x7f) {
>> > >
>> > > This makes it less readable. Why replace the char with a hex
>> > value?
>> >
>> > It is less obvious that '~' is the last ASCII character.
>
> IMHO, it is equally un-obvious that ' ' is the _first_ ASCII
> character, of the printables.  If one wants to go all pedantic
> on the code, isprint() might be better.  But I would probably
> have left it as the original author had, as a quoted character.

Actually, to be really pedantic, one should not use '~'.
Not every codepage has '~' as the character at position 126.

As an example: ISO/IEC 646:1991 German [1], has 'ß' (LATIN SMALL
LETTER SHARP S - u+223) at the position 126.
Look at the wikipedia article [2] for other alternatives of ASCII-126
in this encoding.

This are obsolete codepages, but they still exist (and sometimes you
actually need to use them when talking with legacy devices, like old
printers, or industrial scales).

It was only with ISO-8859-* [3] that the lower 7-bit ASCII characters
were fixed.


Regards,
~Nuno Lucas

[1] http://www.kostis.net/charsets/iso646.de.htm
[2] http://en.wikipedia.org/wiki/ISO/IEC_646
[3] http://en.wikipedia.org/wiki/ISO_8859


More information about the busybox mailing list