Notepad ++转换为UTF-8多个文件 [英] Notepad++ convert to UTF-8 multiple files
本文介绍了Notepad ++转换为UTF-8多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Notepad ++的转换为无BOM的UTF-8功能真的很不错。但我有200个文件,他们都需要覆盖。因此,我发现这个小的python脚本:
The function "Convert to UTF-8 without BOM" of Notepad++ is really nice. But I have 200 files and all of them need to be coverted. Therefor I found this little python script:
import os;
import sys;
filePathSrc="C:\\Temp\\UTF8"
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if fn[-4:] != '.jar' and fn[-5:] != '.ear' and fn[-4:] != '.gif' and fn[-4:] != '.jpg' and fn[-5:] != '.jpeg' and fn[-4:] != '.xls' and fn[-4:] != '.GIF' and fn[-4:] != '.JPG' and fn[-5:] != '.JPEG' and fn[-4:] != '.XLS' and fn[-4:] != '.PNG' and fn[-4:] != '.png' and fn[-4:] != '.cab' and fn[-4:] != '.CAB' and fn[-4:] != '.ico':
notepad.open(root + "\\" + fn)
console.write(root + "\\" + fn + "\r\n")
notepad.runMenuCommand("Encoding", "Convert to UTF-8 without BOM")
notepad.save()
notepad.close()
它遍历每个文件 - >我可以看到这一点。但是在它完成后,字符集是stil ANSI在我的情况:/
It goes through every file -> I can see this. But after it finished, the charset is stil ANSI in my case :/
任何人可以帮助我吗?
推荐答案
有我的错误。我的记事本是德语。因此,请小心,如果它称为编码或在我的情况下Kodierung和转换为UTF-8没有BOM是Konvertiere zu UTF-8 ohne BOM
Got my mistake. My notepad is in german. So take care if it's called "Encoding" or in my case "Kodierung" and "Convert to UTF-8 without BOM" is "Konvertiere zu UTF-8 ohne BOM"
这帮助了我!
这篇关于Notepad ++转换为UTF-8多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文