I have some file / folder names which are not 7-bit clean and they are not displayed correctly in my openSUSE system.
Example for the folder /music/Gabriel_Fauré:
# ls -1d /music/Gabriel_Faur?
/music/Gabriel_Faur??
Perhaps the locale for LC_CTYPE
is not set to some UTF-8 value?
# locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_GB.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_GB.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=a4
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=
Well, that's a nice LC_CTYPE
for Unicode, I think! What does the error message say?
Funnily enough, setting LC_ALL
to the exact value of LC_CTYPE
will work:
# setenv LC_ALL en_US.UTF-8
# ls -1d /music/Gabriel_Faur?
/music/Gabriel_Fauré
However, I do NOT want to set LC_ALL to en_US.UTF-8 (or anything, really) because it messes up some other settings! It would be no fix but only a bad workaround for me.
Also, why is LC_CTYPE ignored by /bin/ls
and/or my shell when printing characters to the screen?
In Arch Linux I would check whether locales are generated but I found nothing on the subject in openSUSE. Also, the locale does seem to exist.
EDIT:
# ls -1d /music/Gabriel_Faur? | hexdump -C
00000000 2f 6d 75 73 69 63 2f 47 61 62 72 69 65 6c 5f 46 |/music/Gabriel_F|
00000010 61 75 72 c3 a9 0a |aur...|
00000016
So it's correct UTF-8 (as far as I can tell).
EDIT2:
# locale -a | grep en_US
en_US
en_US.iso885915
en_US.utf8
# locale -a | wc -l
495
EDIT3 (after correct Answer):
# unsetenv LC_PAPER
# unsetenv LC_ALL
# ls -1d /*/Gabriel_Faur?
/music/Gabriel_Fauré
The LC_PAPER=a4
variable prevents UTF-8 encoded Unicode characters from being printed (no pun intended) on screen!
echo /music/Gabriel_Faur?|hexdump -C
print?