|
@@ -5,16 +5,16 @@ import codecs
|
|
|
|
|
|
rootdir = "./units"
|
|
rootdir = "./units"
|
|
|
|
|
|
-source_encoding = "ANSI"
|
|
|
|
|
|
+source_encoding = "ISO-8859"
|
|
target_encoding = "utf-8"
|
|
target_encoding = "utf-8"
|
|
|
|
|
|
for root, subdirs, files in os.walk(rootdir):
|
|
for root, subdirs, files in os.walk(rootdir):
|
|
for filename in files:
|
|
for filename in files:
|
|
if filename[-4:] == ".txt":
|
|
if filename[-4:] == ".txt":
|
|
print(os.path.join(root, filename))
|
|
print(os.path.join(root, filename))
|
|
- source = codecs.open(os.path.join(root, filename), 'r', source_encoding).read()
|
|
|
|
|
|
+ source = open(os.path.join(root, filename), 'r').read()
|
|
print(u''.join(source))
|
|
print(u''.join(source))
|
|
|
|
|
|
- final = open(os.path.join(root, filename), 'w')
|
|
|
|
|
|
+ final = codecs.open(os.path.join(root, filename), 'w', target_encoding)
|
|
print(u''.join(source), file = final)
|
|
print(u''.join(source), file = final)
|
|
final.close()
|
|
final.close()
|