Command line 记事本++;从命令行打开文件、更改编码并保存
我从命令行中搜索使用Notepad++执行自动任务的方法:Command line 记事本++;从命令行打开文件、更改编码并保存,command-line,character-encoding,notepad++,Command Line,Character Encoding,Notepad++,我从命令行中搜索使用Notepad++执行自动任务的方法: 打开文件 将编码更改为UTF-8 保存文件 有什么方法可以用插件或者其他程序来完成吗?为什么要用Notepad++来完成这个任务?你正在使用哪个操作系统? Notepad++有一个插件管理器,您可以在其中安装Python脚本插件 但是,如果您想将文件转换为UTF8,可以通过Windows上的PowerShell或Linux上的命令行更轻松地实现 对于Windows Power Shell: $yourfile = "C:\path\t
有什么方法可以用插件或者其他程序来完成吗?为什么要用Notepad++来完成这个任务?你正在使用哪个操作系统? Notepad++有一个插件管理器,您可以在其中安装Python脚本插件 但是,如果您想将文件转换为UTF8,可以通过Windows上的PowerShell或Linux上的命令行更轻松地实现 对于Windows Power Shell:
$yourfile = "C:\path\to\your\file.txt"
get-content -path $yourfile | out-file $yourfile -encoding utf8
对于Linux使用(例如)iconv:
只要您希望UTF8文件包含BOM表,Powershell就可以了,这是默认设置,不容易处理。@Broco运行此脚本时,输出文件为空。知道为什么吗?
iconv -f ISO-8859-15 -t UTF-8 source.txt > new-file.txt