Datasets:

Modalities:
Text
Languages:
Chinese
Tags:
Not-For-All-Audiences
License:
Sci-Fi-ZH / convertToUTF8.py
Limour's picture
Upload convertToUTF8.py
68c050b verified
raw
history blame contribute delete
742 Bytes
#-*- encoding:utf-8 -*-
#
# Notepad++ Python script plugin script.
# For converting file encoding & lineending.
#
import os
import sys
filePathSrc = notepad.prompt("请输入目录路径".decode('utf-8').encode('gbk'), "输入目录路径".decode('utf-8').encode('gbk'))
filter_exts = [".txt"]
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
print fn.decode('gbk').encode('utf-8')
file_name, file_ext = os.path.splitext(fn)
if file_ext in filter_exts:# Specify type of the files
notepad.open((root + "\\" + fn).decode('gbk').encode('utf-8'))
print notepad.menuCommand(MENUCOMMAND.FORMAT_CONV2_AS_UTF_8)
notepad.save()
notepad.close()
print 'finish'