On 02/06/2021 08:39, henkelma...@yahoo.co.jp wrote:
Hi,
I see an unexpected result when listing files with GNU ls and Japanese locale.
The Japanese character for day (日) is missing.
Expected result - same as UNIX (Solaris 10 for example):
-bash-3.2$ LANG=ja_JP.UTF-8 ls -ld /etc
drwxr-xr-x 81 root sys 5120 5月 24日 15:19 /etc
Actual result:
Solaris with gnu ls provided by csw
-bash-3.2$ /opt/csw/bin/gls --version
ls (GNU coreutils) 8.22
-bash-3.2$ LANG=ja_JP.UTF-8 /opt/csw/bin/gls -ld /etc
drwxr-xr-x 81 root sys 5120 5月 24 15:19 /etc
Same for Linux (Ubuntu 20.04 - ls (GNU coreutils) 8.30 )
LANG=ja_JP.utf8 ls -ld /etc
drwxr-xr-x 139 root root 12288 5月 29 06:17 /etc
The same seems to apply for Chinese as well:
LANG=zh_TW.utf8 ls -ld /etc
drwxr-xr-x. 107 root root 8192 5月 28 20:29 /etc
LANG=zh_CN.utf8 ls -ld /etc
drwxr-xr-x. 107 root root 8192 5月 28 20:29 /etc
It seems strange to me, because the character for month (月) is printed, but the
one for day (日) is missing.
Is this a bug or am I doing something wrong?
This is a result of the locale setup of the system.
On Linux at least you can see the available time/date settings with:
LC_ALL=ja_JP.utf8 locale -kc LC_TIME
That shows there is no way to lookup the format you desire in a generic way on
Linux.
ls does give you quite a bit of control over the date/time display though.
You could have a 日本語 specific setting using:
export TIME_STYLE=$'+%b %e日 %Y\n%b %e日 %H:%M'
Then `ls -l` should display as you expect.
cheers,
Pádraig