1
我需要通過Notepad ++將某些文件的編碼更改爲UTF-8。我發現這個腳本的Python腳本插件,它改變了所有的文件編碼的文件夾中:Notepad ++ Python腳本無法打開文件名中帶有特殊字符的文件
import os;
import sys;
filePathSrc="C:\\Users\\" # Path to the folder with files to convert
for root, dirs, files in os.walk(filePathSrc):
for fn in files:
if fn[-4:] == '.txt': # Specify type of the files
notepad.open(root + "\\" + fn)
notepad.runMenuCommand("Encoding", "Convert to UTF-8")
notepad.save()
notepad.close()
它的工作原理爲我好,但情況下,當在foler文件有不尋常的非英語字符的文件名(如é ,Ø,ß等)。說到這個文件,Notepad ++顯示了建立新文件的建議「C:\ Somefile.txt不存在,創建它?」而不是打開它。
有助於教Notepad ++和此腳本也打開此文件。
我發現在記事本++ [論壇](http://sourceforge.net/p/npppythonscript/discussion/1188886/thread/8f556f46/)的建議設置文件路徑本身的編碼UTF-8,但我不熟悉編程,不知道如何修改這個特定的腳本。 – Lulu