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

non*_*ity 11 bash unicode ls tree ubuntu

Ubuntu 10.04ls可以显示 unicode 字符,但tree不能显示,即使使用tree --charset unicodeutf8。有没有办法解决。 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
Run Code Online (Sandbox Code Playgroud)