Datasets:

Languages:
Chinese
Tags:
Not-For-All-Audiences
Libraries:
Datasets
License:
Limour commited on
Commit
68c050b
1 Parent(s): 9f003e7

Upload convertToUTF8.py

Browse files
Files changed (1) hide show
  1. convertToUTF8.py +21 -0
convertToUTF8.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #-*- encoding:utf-8 -*-
2
+ #
3
+ # Notepad++ Python script plugin script.
4
+ # For converting file encoding & lineending.
5
+ #
6
+ import os
7
+ import sys
8
+
9
+ filePathSrc = notepad.prompt("请输入目录路径".decode('utf-8').encode('gbk'), "输入目录路径".decode('utf-8').encode('gbk'))
10
+ filter_exts = [".txt"]
11
+
12
+ for root, dirs, files in os.walk(filePathSrc):
13
+ for fn in files:
14
+ print fn.decode('gbk').encode('utf-8')
15
+ file_name, file_ext = os.path.splitext(fn)
16
+ if file_ext in filter_exts:# Specify type of the files
17
+ notepad.open((root + "\\" + fn).decode('gbk').encode('utf-8'))
18
+ print notepad.menuCommand(MENUCOMMAND.FORMAT_CONV2_AS_UTF_8)
19
+ notepad.save()
20
+ notepad.close()
21
+ print 'finish'