Welcome! Log In Create A New Profile

Advanced

Garbage characters on directory and/or file name

Posted by habibie 
Garbage characters on directory and/or file name
March 16, 2018 06:49PM
On my Seagate Dockstar running on debian ARMel, ls -al returns all Chinese characters of a directory and/or file name as ?????? (see below)
[root@debian:/root 3%] # ls -la /srv/
total 12
drwxr-xr-x  3 root   root    4096 Mar 15 22:34 .
drwxr-xr-x 21 root   root    4096 Feb 16  2015 ..
drwxr-xr-x  2 nobody nogroup 4096 Mar 16 13:05 ????????????
[root@debian:/root 4%] # ls -la /srv/\347\273\247\347\210\266\345\233\236\345\256\266/
total 876960
drwxr-xr-x 2 nobody nogroup      4096 Mar 16 13:05 .
drwxr-xr-x 3 root   root         4096 Mar 15 22:34 ..
-rw-r--r-- 1 nobody nogroup 178467784 Feb 15 19:15 ?????????.mp4
-rw-r--r-- 1 nobody nogroup 180803541 Feb 15 21:18 ?????????.mp4
-rw-r--r-- 1 nobody nogroup 182210980 Mar 15 22:32 ?????????.mp4
-rw-r--r-- 1 nobody nogroup 177843368 Feb 15 22:20 ?????????.mp4
-rw-r--r-- 1 nobody nogroup 178652002 Feb 16 11:56 ?????????.mp4
[root@debian:/root 5%] #
OTOH, this does not happen when I tried the same thing on my OpenSuSE Linux desktop computer (see below). Is there a package I must install to remedy this issue?
[habibie@linux:/mnt/exports/devel/openwrt-git-trunk 276%] ~ ls -la /mnt/
total 12
drwxr-xr-x  3 root   root    4096 Mar 15 22:34 .
drwxr-xr-x 23 root   root    4096 Sep  9  2017 ..
drwxr-xr-x  2 nobody nogroup 4096 Mar 16 13:05 继父回家
[habibie@linux:/mnt/exports/devel/openwrt-git-trunk 277%] ~ ls -la /mnt/继父回家/
total 876960
drwxr-xr-x 2 nobody nogroup      4096 Mar 16 13:05 .
drwxr-xr-x 3 root   root         4096 Mar 15 22:34 ..
-rw-r--r-- 1 nobody nogroup 178467784 Feb 15 19:15 第一集.mp4
-rw-r--r-- 1 nobody nogroup 180803541 Feb 15 21:18 第三集.mp4
-rw-r--r-- 1 nobody nogroup 182210980 Mar 15 22:32 第二集.mp4
-rw-r--r-- 1 nobody nogroup 177843368 Feb 15 22:20 第五集.mp4
-rw-r--r-- 1 nobody nogroup 178652002 Feb 16 11:56 第四集.mp4
[habibie@linux:/mnt/exports/devel/openwrt-git-trunk 278%] ~
Re: Garbage characters on directory and/or file name
March 16, 2018 08:02PM
It could a setting in the terminal program your using to access your Dockstar. I use PuTTY with the Window Translation set to UTF-8 and I can view file names with Chinese characters properly on my Dockstar. I don't believe I've ever installed anything extra.

-JT
Re: Garbage characters on directory and/or file name
March 16, 2018 10:12PM
Yes, there is some minimum UTF-8 setup needed. I will post my settings (in my log somewhere).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
How to enable UTF-8 for different languages in your system
March 17, 2018 02:18AM
How to enable UTF-8 for different languages in your system.

=============================================

Please adjust the locale to your own country. This example uses US UTF-8.

Prerequisite:

locales was already installed with:
apt-get install locales

Steps:

1. Change locale.gen (uncomment the appropriate line).

cat locale.gen
# This file lists locales that you wish to have built. You can find a list
# of valid supported locales at /usr/share/i18n/SUPPORTED, and you can add
# user defined locales to /usr/local/share/i18n/SUPPORTED. If you change
# this file, you need to rerun locale-gen.

<snip>

en_US.UTF-8 UTF-8

2. Run locale-gen to generate locale

locale-gen
Output:
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.

3. Create UTF-8 Language export in your root login and user accounts

echo "export LANG=en_US.UTF-8" > ~/.utf8

4. Include the UTF-8 export in your root or other users .profile

cat ~/.profile
# ~/.profile: executed by Bourne-compatible login shells.

<snip>

. ~/.utf8

5. Install unicode

apt-get install xfonts-efont-unicode
apt-get install xfonts-efont-unicode-ib

6. Reboot. Upon the system is up, Samba should present to the display on your other machine directory explorer, finder, ... utf-8 compliance file names.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 3 time(s). Last edit at 03/19/2018 01:22AM by bodhi.
Re: Garbage characters on directory and/or file name
March 17, 2018 08:14AM
renojim Wrote:
-------------------------------------------------------
> It could a setting in the terminal program your using to access your Dockstar. I use PuTTY with the Window Translation set to UTF-8 and I can view file names with Chinese characters properly on my Dockstar. I don't believe I've ever installed anything extra.
>
> -JT
>
My OpenSUSE Linux Desktop computer correctly displays the Chinese characters. However, when I connect to my Seagate Dockstar through an SSH login from the same OpenSUSE Linux Desktop computer, the directory listing shows ????? characters as a filename. Using the same OpenSUSE Linux Desktop computer to connect to another OpenSUSE Linux Desktop computer through an SSH login, I have no problem to list some directories in Chinese characters. As such, I don't think this has anything to do with an SSH session, but rather I suspect it has something to do with the settings and/or missing packages on my Seagate Dockstar.
Re: Garbage characters on directory and/or file name
March 17, 2018 08:15AM
Bodhi,

I ran into these problems:
  1. I really don't know where to find the locale.gen file.
  2. There was no such locale-gen utility and I had to install the locales package (apt-get install locales) to get the locale-gen utility.
  3. After installing the locales package, I executed locale-gen and it does not produce the ~/.utf8 file as you pointed out above.
[root@debian:/root 28%] # locale-gen
Generating locales (this might take a while)...
Generation complete.
[root@debian:/root 29%] # ls -la
total 40
drwx------  5 root root 4096 Mar 17 08:47 .
drwxr-xr-x 21 root root 4096 Feb 16  2015 ..
-rw-r--r--  1 root root  570 Jan 31  2010 .bashrc
drwx------  3 root root 4096 Jun 14  2013 .config
drwxr-xr-x  2 root root 4096 Jul 23  2017 .nano
-rw-r--r--  1 root root  481 Jul 20  2017 .profile
drwx------  2 root root 4096 Jul 23  2017 .ssh
-rw-------  1 root root 9484 Mar 17 08:47 .viminfo
[root@debian:/root 30%] #

Anyway, when I installed the psmisc package, apt-get spits out some warnings w.r.t locales (see below).
[root@debian:/root 26%] # apt-get install psmisc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  psmisc
0 upgraded, 1 newly installed, 0 to remove and 174 not upgraded.
Need to get 113 kB of archives.
After this operation, 532 kB of additional disk space will be used.
Get:1 http://ftp.us.debian.org/debian buster/main armel psmisc armel 23.1-1 [113 kB]
Fetched 113 kB in 0s (123 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LC_TIME = "en_US.UTF-8",
        LC_MONETARY = "en_US.UTF-8",
        LC_COLLATE = "en_US.UTF-8",
        LC_MEASUREMENT = "en_US.UTF-8",
        LC_NUMERIC = "en_US.UTF-8",
        LANG = "C"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package psmisc.
(Reading database ... 21696 files and directories currently installed.)
Preparing to unpack .../psmisc_23.1-1_armel.deb ...
Unpacking psmisc (23.1-1) ...
Setting up psmisc (23.1-1) ...
Processing triggers for man-db (2.7.6.1-2) ...
10.844u+1.908s=0:34.70e(36.7%) TDSavg=0k+0k+0k max=81664k 160584+80184io 121pf+0sw
[root@debian:/root 27%] #
Re: Garbage characters on directory and/or file name
March 17, 2018 08:32AM
Bodhi,

After some googling around, I found this article (even though the author did not seem to completely resolve his/her issue) and managed to resolve the issue by re-configuring locales using dpkg-reconfigure locales (see below).
[root@debian:/root 6%] # dpkg-reconfigure locales
 Package configuration
┌────────────────────────────────────────────────────Configuring locales───────────────────────────────────────────────────────┐─
│ Locales are a framework to switch between multiple languages and allow users to use their language, country, characters,     │
│ collation order, etc.                                                                                                        │
│
│ Please choose which locales to generate. UTF-8 locales should be chosen by default, particularly for new installations.      │
│ Other character sets may be useful for backwards compatibility with older systems and software.                              │
│
│ Locales to be generated:                                                                                                     │
│ ┌───────────────────────────────────────────────↑(-)───────────────────────────────────────────────────────────────────────┐ │
│ │                                           [ ] en_US.ISO-8859-15 ISO-8859-15                                              │ │
│ │                                           [*] en_US.UTF-8 UTF-8                                                          │ │
│ │                                           [ ] en_ZA ISO-8859-1                                                           │ │
│ │                                           [ ] en_ZA.UTF-8 UTF-8                                                          │ │
│ │                                           [ ] en_ZM UTF-8                                                                │ │
│ │                                           [ ] en_ZW ISO-8859-1                                                           │ │
│ │                                           [ ] en_ZW.UTF-8 UTF-8                                                          │ │
│ └───────────────────────────────────────────────↓(+)───────────────────────────────────────────────────────────────32%─────┘ │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                           <  OK  >                      <Cancel>                                             │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
  

 Package configuration
 ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

┌────────────────────────────────────────────────────Configuring locales───────────────────────────────────────────────────────┐
│ Many packages in Debian use locales to display text in the correct language for the user. You can choose a default locale    │
│ for the system from the generated locales.                                                                                   │
│
│ This will select the default language for the entire system. If this system is a multi-user system where not all users       │
│ are able to speak the default language, they will experience difficulties.                                                   │
│
│ Default locale for the system environment:                                                                                   │
│ ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │
│ │                                                      [ ] None                                                            │ │
│ │                                                      [ ] C.UTF-8                                                         │ │
│ │                                                      [*] en_US.UTF-8                                                     │ │
│ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                           <  OK  >                      <Cancel>                                             │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘




Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.
14.661u+2.684s=0:43.05e(40.2%) TDSavg=0k+0k+0k max=64212k 512+5744io 14pf+0sw
[root@debian:/root 7%] # dir /srv/
total 4
drwxr-xr-x 2 nobody nogroup 4096 Mar 16 13:05 继父回家
[root@debian:/root 8%] # dir /srv/继父回家/
total 876952
-rw-r--r-- 1 nobody nogroup 178467784 Feb 15 19:15 第一集.mp4
-rw-r--r-- 1 nobody nogroup 180803541 Feb 15 21:18 第三集.mp4
-rw-r--r-- 1 nobody nogroup 182210980 Mar 15 22:32 第二集.mp4
-rw-r--r-- 1 nobody nogroup 177843368 Feb 15 22:20 第五集.mp4
-rw-r--r-- 1 nobody nogroup 178652002 Feb 16 11:56 第四集.mp4
[root@debian:/root 9%] #
Re: Garbage characters on directory and/or file name
March 17, 2018 01:45PM
So it looks like you got it sorted out. Great! Right after I posted I thought about locales and dpkg-reconfigure and the trouble I had long ago with foreign characters. That was going to be my next suggestion, but you beat me to it.

-JT
Re: Garbage characters on directory and/or file name
March 17, 2018 04:32PM
JT,

I don't recall using dpkg-reconfigure at all. I think if you apt-get install locales, everything should be good.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: