Skip to content

Commit

Permalink
修复Markdown文集zip压缩包导入后文档乱码的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
zmister committed Oct 16, 2021
1 parent df7f481 commit 5034ca7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app_doc/import_utils.py
Expand Up @@ -41,15 +41,15 @@ def read_zip(self,zip_file_path,create_user):
for root, dirs, files in os.walk(self.temp_dir):
for dir in dirs:
try:
new_dir = dir.encode('cp437').decode('gbk')
new_dir = dir.encode('cp437').decode('utf-8')
except:
new_dir = dir.encode('utf-8').decode('utf-8')
# print(new_dir)
os.rename(os.path.join(root, dir), os.path.join(root, new_dir))

for file in files:
try:
new_file = file.encode('cp437').decode('gbk')
new_file = file.encode('cp437').decode('utf-8')
except:
new_file = file.encode('utf-8').decode('utf-8')
# print(root, new_file)
Expand Down

0 comments on commit 5034ca7

Please sign in to comment.