系统:ubuntu16.04
问题描述:
在windows上一切正常,复制到ubuntu上,中文文件名和内容都显示乱码。
在windows上:
在ubuntu上:
解决方法:
1、修改文件名
sudo apt-get install convmv
convmv -f GBK -t UTF-8 --notest ./*
2、修改文件内容
#输入输出文件名不能相同,否则文件会被清空
iconv -f GBK -t UTF-8 你好_123.txt > 你好_123.txt.u
3、批量修改文件内容
find *.txt -exec sh -c "iconv -f GBK -t UTF-8 {} > {}.u"
#删除txt
rm *.txt
#重命名 utf8 到 txt
rename 's/\.u$//' *.u
参考:
https://blog.csdn.net/ngy321/article/details/79877451
https://blog.csdn.net/zxlworking1/article/details/91457384
https://blog.csdn.net/weixin_39792252/article/details/80415550 这篇文章不能解决从windows传过来的中文乱码。所有 和 locale 、LANG、LANGAUE 等设置相关的都是解决系统语言问题的。