当前位置: 首页>>技术教程>>正文


Ubuntu的ls可以显示unicode字符,但是tree不能显示,即使使用tree –charset unicode

, , , ,

问题描述

Ubuntu 10.04的ls可以显示unicode字符,但是即使使用tree --charset unicodeutf8tree也不能显示。有没有办法解决。 echo可以解释转义字符,但cat list.txt | echo -e不起作用(list.txt来自tree > list.txt)

更新:tree -H www.somewhere.com可以输出unicode(应为UTF-8),但现在看来,这是唯一的方法-作为网页。

$ ls -R
.:
list2.txt  list.txt  久未在遊行場合露面的前總統李登輝.txt  遊行

./遊行:
大家2.txt  大家.txt

$ tree --charset unicode
.
|-- list2.txt
|-- list.txt
|-- \344\271\205\346\234\252\345\234\250\351\201\212\350\241\214\345\240\264\345\220\210\351\234\262\351\235\242\347\232\204\345\211\215\347\270\275\347\265\261\346\235\216\347\231\273\350\274\235.txt
`-- \351\201\212\350\241\214
    |-- \345\244\247\345\256\2662.txt
    `-- \345\244\247\345\256\266.txt

1 directory, 5 files

$ tree --charset utf8
.
├── list2.txt
├── list.txt
├── \344\271\205\346\234\252\345\234\250\351\201\212\350\241\214\345\240\264\345\220\210\351\234\262\351\235\242\347\232\204\345\211\215\347\270\275\347\265\261\346\235\216\347\231\273\350\274\235.txt
└── \351\201\212\350\241\214
    ├── \345\244\247\345\256\2662.txt
    └── \345\244\247\345\256\266.txt

1 directory, 5 files

最佳方案

尝试这个:

tree -N

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/8761.html,未经允许,请勿转载。