I am on Xigmanas (NAS freebsd). I'll explain the situation as simply as possible:
:; set | egrep 'LC_A|LANG'
GDM_LANG=fr_FR.UTF-8
LANG=fr_FR.UTF-8
LC_ALL=fr_FR.UTF-8
SLIM_LANG=fr_FR.UTF-8
:; ls -i 1989* ; ls -i | grep 1989 ; ls -ib 1989* ; ls -ib | grep 1989
9920 1989 Amn??sia.mp4
9920 1989 Amnésia.mp4
9920 1989 Amn\303\251sia.mp4
9920 1989 Amn\303\251sia.mp4
We see that with ls
only the accent is transformed into ??
And this is not the case with the pipe followed by grep
.
I don't see an explanation since the pipe should not modify the byte stream especially not by correcting the flow!
ls
followed by grep
displays correctly while ls
alone is incorrect.
What's going on?
locale charmap
? It's possible your system doesn't have afr_FR.UTF-8
locale installed or as Chris said that you didn't export thatLC_ALL
variable to the environmnent. Can you see that locale in the output oflocale -a
? – Stéphane Chazelas Mar 09 '24 at 20:08ls -i 1989*
andls -i | grep 1989
would generate different outputs are when there is any file with1989
in its name but not at the start of the name, or when a file has an inode number that includes the1989
substring, or (on some systems) if any file whose name starts with1989
also has one or several embedded newline characters in its name. – Kusalananda Mar 10 '24 at 12:47FreeBSD
so I will strongly suggest to uselocale
command to verify and see this on how to use login classes rather than settingLC_*
directly. Have you tested with the defaultC.UTF8
? – Claus Andersen Mar 14 '24 at 10:59