[Tcsh] 8 bit character bug in $'...' format?
Kimmo Suominen
kim at netbsd.org
Tue May 6 10:28:12 UTC 2025
On Mon, May 05, 2025 at 09:00:40AM -0400, Christos Zoulas wrote:
> > On May 4, 2025, at 7:13 AM, Jamie Landeg-Jones <jamie at catflap.org> wrote:
> > I assumed the " \nnn The character corresponding to the octal number nnn."
> > format would work with values between \200 to \377 but it instead seems to
> > utf-8 the result:
> >
> > root at catflap# printf $'\177' | bindump
> > 7f
> >
> > root at catflap# printf $'\200' | bindump
> > c2 80
> >
> What version?
>
> [8:59am] 103>printf $'\200' | hexdump -C
> 00000000 80 |.|
> 00000001
> [8:59am] 104>echo $version
> tcsh 6.24.10 (Astron) 2023-04-14 (x86_64-amd-NetBSD) options wide,nls,dl,al,kan,sm,rh,color,filec
To reproduce one has to be using a UTF-8 locale:
: equinoxe:~ % ; uname -srm
NetBSD 10.1_STABLE amd64
: equinoxe:~ % ; echo $version
tcsh 6.24.15 (Astron) 2025-02-04 (x86_64-amd-NetBSD) options wide,nls,dl,al,kan,sm,rh,color,filec
: equinoxe:~ % ; env | grep -E 'LANG|LC_'
LANG=C.UTF-8
LC_CTYPE=C.UTF-8
: equinoxe:~ % ; printf $'\200' | hexdump -C
00000000 c2 80 |..|
00000002
: equinoxe:~ % ; unsetenv LC_CTYPE
: equinoxe:~ % ; unsetenv LANG
: equinoxe:~ % ; printf $'\200' | hexdump -C
00000000 80 |.|
00000001
: equinoxe:~ % ; exit
I got the same results with both 6.24.15 and 6.24.10.
I also tested with 6.24.15 on Debian 12.10 and got the same results.
Kind regards,
+ Kimmo
More information about the Tcsh
mailing list