Debian系统解决文件夹中文乱码的方案

如上图所示,从网上下载的压缩包默认情况下解压后文件文件夹中文显示乱码,其主要问题是该文件在windows下打包,字符集标准是GBK,为解决此问题,网络上提供了几种方案,第一种是直接把windows的简体中文字体文件复制到debian的字体目录下,具体操作方法如下:

从windows的字体目录中找到simsun.ttc文件,通过WinSCP工具连接上debian系统,把该文件传送到该系统中的/usr/share/fonts/truetype目录下,注意要进行该操作,当前用户一定要具有管理员权限,否则会复制失败。

第二种是在Linux中安装一种工具:convmv,用其进行文件名编码的转换,可以将文件名从GBK转换成UTF-8编码,或者从UTF-8转换到GBK。

convmv语法格式: convmv [options] FILE(S)

常用参数:
-f enc encoding from which should be converted
-t enc encoding to which should be converted
-r recursively go through directories
-i interactive mode (ask for each action)
–nfc target files will be normalization form C for UTF-8 (Linux etc.)
–nfd target files will be normalization form D for UTF-8 (OS X etc.)
–qfrom be quiet about the “from” of a rename (if it screws up your terminal e.g.)
–qto be quiet about the “to” of a rename (if it screws up your terminal e.g.)
–exec c execute command instead of rename (use #1 and #2 and see man page)
–list list all available encodings
–lowmem keep memory footprint low (see man page)
–map m apply an additional character mapping
–nosmart ignore if files already seem to be UTF-8 and convert if posible
–notest actually do rename the files
–replace will replace files if they are equal
–unescape convert%20ugly%20escape%20sequences
–upper turn to upper case
–lower turn to lower case
–parsable write a parsable todo list (see man page)
–help print this help

第三种方案解决linux解压压缩包中文文件名乱码问题最为简单,也是我自己采用的方案。使用unar解压缩工具提取文件,具体方法如下:

1使用命令sudo apt install unar安装unar。

2.使用命令unar example.zip解压文件后,即可解决乱码问题。

unar的语法格式:unrar [选项] [参数]

常用参数:

-e将文件解压缩到当前目录
-l列出存档内容
-p将文件打印到标准输出
-t测试存档文件
-v详细列出存档
-x使用完整路径提取文件

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注