▶ tree 下载 -L 1
344円270円213円350円275円275円
├── BT
├── ISO
├── Let\ s\ Play\ -\ Sniper\ Elite\ v2\ Nazi\ Zombie\ Army.flv
├── sniper\ elite\ v2\ 02.flv
└── 350円275円257円344円273円266円345円214円205円
those 7-bit ASCII output is non identifiable to human. Normally I use ascii2uni -a K
to convert into UTF8. but in Fedora 25, the uni2ascii
is not in repo. So any other way to make it output UTF8?
2 Answers 2
I found another answer on StackOverflow. Making changes to my locale settings didn't help at all, but using the -N
option with tree did.
# tree -if ./my-path/
./my-path/Olaf\ Hund\ Vs\ Ursari\ De\ Clejani\ _\ Taraf\ De\ Hai210円douks\ _\ Koçani\ Orkestar\ -\ electric\ gypsyl.mp3
# tree -ifN ./my-path/
./my-path/Olaf Hund Vs Ursari De Clejani _ Taraf De Haïdouks _ Koçani Orkestar - electric gypsyl.mp3
Note that this also un-escapes spaces.
-
It's 2 years post, fc31 is OK now. No need -N or any other command switch.eexpress– eexpress2020年03月11日 13:39:16 +00:00Commented Mar 11, 2020 at 13:39
-
1What is fc31? Another command line tool?Pavel Lishin– Pavel Lishin2020年03月12日 16:20:57 +00:00Commented Mar 12, 2020 at 16:20
-
-N fix Chinese issue.Sun Junwen– Sun Junwen2022年08月02日 02:17:40 +00:00Commented Aug 2, 2022 at 2:17
Set the encoding to UTF-8
(and choose an appropriate locale that has support for Unicode) e.g.:
LC_ALL=en_US.UTF-8 tree -L 1 下载
Presumably you are using a locale that can not interpret those characters (C
maybe?).
Example:
% LC_ALL=C tree 下载
344円270円213円350円275円275円
`-- foo
% LC_ALL=en_US.UTF-8 tree 下载
下载
└── foo
-
1LC_ALL not work at all. all LC_* except LC_ALL is "zh_CN.UTF-8" in
locale
. paste.fedoraproject.org/paste/…eexpress– eexpress2017年05月24日 05:25:57 +00:00Commented May 24, 2017 at 5:25