批量轉換編碼 (gbk -> utf8)


使用 Notepad++ 批量的轉換文件編碼:Mass convert a project to UTF-8 using Notepad++

步驟如下:

1、一般 Noptepad++ 安裝完后已經自帶了一個 Plugin Manger ,在 Plugins 菜單下面可見,如果沒有,自行安裝

2、打開 Plugin Manager ,在 Available 下面的列表中找到 Python Script ,Install,Restart

3、打開 Python Script,New Script

腳本如下(其中的文件后綴可根據需要修改):

import os;
import sys;
path="D:\\Documents\\Unity\\"
for root, dirs, files in os.walk(path):
    for file in files:
        if file.endswith(".cs") or file.endswith(".js") or file.endswith(".txt"):
            notepad.open(root + "\\" + file)
            console.write(root + "\\" + file+ "\r\n")
            notepad.runMenuCommand("Encoding", "Convert to UTF-8")
            notepad.save()
            notepad.close()

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM