notepad++批量转换文件编码
来源:互联网 发布:http load windows 64 编辑:程序博客网 时间:2024/06/07 06:11
原出处:http://stackoverflow.com/questions/7256049/notepad-converting-ansi-encoded-file-to-utf-8
Here some simple steps to convert multiple files via Notepad++ without messing up with special characters (for ex. diacritical marks).
- Run Notepad++ and then open menu Plugins->Plugin Manager->Show Plugin Manager
- Install Python Script. When plugin is installed, restart the application.
- Choose menu Plugins->Python Script->New script.
- Choose its name, and then past the following code:
convertToUTF8.py
import os;import sys;filePathSrc="C:\\Users\\" # Path to the folder with files to convertfor root, dirs, files in os.walk(filePathSrc): for fn in files: if fn[-4:] == '.xml': # Specify type of the files notepad.open(root + "\\" + fn) notepad.runMenuCommand("Encoding", "Convert to UTF-8") notepad.save() notepad.close()
After all, run the script
注意事项:操作前必须把notepad++语言设置成英文。否则执行没效果。参考:http://blog.csdn.net/a_flying_bird/article/details/51263375
即点击下面的菜单,不知道执行了没有,可以到代码里面加个打印 print "Convert to ANSI" ,打开菜单里面的 Show Console 可以看到Python打印结果。
如果要转化为ANSI 就把插件代码改为下面,说明一下下面的fn[-2:],指寻找后面2个字符匹配的路径后缀为.h ,如果你要匹配.php ,则应该是fn[-4:]
import os;import sys;sys.stdout = consoleprint "Convert to ANSI" filePathSrc="E:\\CodeGames\\pf_win-master" # Path to the folder with files to convertfor root, dirs, files in os.walk(filePathSrc): for fn in files: if fn[-2:] == '.h': # Specify type of the files notepad.open(root + "\\" + fn) notepad.runMenuCommand("Encoding", "Convert to ANSI") notepad.save() notepad.close()
阅读全文
0 0
- notepad++批量转换文件编码
- 使用notepad++批量转换文件编码
- 使用notepad++和editplus批量转换文件编码
- 使用Notepad++批量转换源代码编码方式
- 批量转换文件编码
- 批量转换文件编码
- 批量文件编码转换
- 利用notepad++中安装python脚本实现批量转换文件编码
- php文件编码批量转换
- 批量转换文件编码_php
- Java批量转换文件编码
- python批量转换文件编码
- linux批量转换文件编码
- Linux批量转换文件编码
- shell批量文件编码转换
- python批量转换文件编码
- Eclipse 批量转换文件编码
- notepad++ 编码转换
- 数据归档压缩和远程传输
- Django环境搭建
- 利用PLSQL Developer 修改同步数据库间表结构
- 表格排序
- CORS跨域请求以及spring boot集成
- notepad++批量转换文件编码
- web.xml拆分
- NOIp2014 题解
- Unix-2-CRUD-分页+模糊查询-状态更改
- PHPMailer发邮件
- JSP/Servlet中的相对路径和绝对路径。
- panda中contains函数的用法
- 【广告算法工程师入门 23】机制设计-GSP机制下的收入优化
- C#语言基础回忆