openwrt ls命是busybox提供的,中文通通显示为???,google了一些资料,重新配置编译了一下busybox,中文能正常显示了。
先搭建好交叉编译环境(不在本文讨论范围内),我用的openwrt 12.09 rc1 的源码路由器是WR703N。进入源码目录make menuconfig,进入Base System -> Busybox -> Busybox Settings -> General Configuration 配置页面,按下面所示配置busybox(195101的值是根据参考文章中的十六制值得来的)保存配置。
[*] Support Unicode │ │ [ ] Check $LANG environment variable │ │ (195101) Character code to substitute unprintable characters with │ │ (195101) Range of supported Unicode characters │ │ [*] Allow zero-width Unicode characters on output │ │ [*] Allow wide Unicode characters on output │ │ [*] Bidirectional character-aware line input │ │ [*] In bidi input, support non-ASCII neutral chars too │ │ [*] Make it possible to enter sequences of chars which are not Unicode
然后执行make package/busybox/compile,编译完成后在build_dir/target-mips_r2_uClibc-0.9.33.2/busybox-1.19.4/ 找到新生成的busybox可执行文件,替换掉openwrt的/bin/busybox文件即可。