LoginSignup
1
0

More than 5 years have passed since last update.

tar 文件名乱码

Last updated at Posted at 2016-12-12

use chardet detect file name encoding

python2

import chardet
chardet.detect("\311\372\311\372\312\300\312\300\260\256") # => {'confidence': 0.99, 'encoding': 'GB2312'}

python3

import chardet
chardet.detect(b"\311\372\311\372\312\300\312\300\260\256") # => {'confidence': 0.99, 'encoding': 'GB2312'}

then use convmv convert file name encoding

convmv -f gbk -t utf8 -r dir_path

or

convmv -f gb2312 -t utf8 -r dir_path

use convmv --list list all encoding

chardet is very powerful

python3 use chardet detect file content encoding

import chardet
chardet.detect(open("01.flac",'rb').read(100)) # => {'encoding': 'windows-1253', 'confidence': 0.8902671920769272}

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0