批量转换编码 (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