试了下直接转编码格式,中文会乱码 有没有工具可以统一转下,中文也能正常显示。 谢谢各位
1 cooleggs 2022-02-28 15:00:00 +08:00 vscode 不就可以么,so easy |
![]() | 2 BrettD 2022-02-28 15:00:18 +08:00 via iPhone ![]() iconv |
![]() | 3 knightdf 2022-02-28 15:05:35 +08:00 ![]() iconv +1 |
![]() | 4 unishare 2022-02-28 15:06:11 +08:00 有可以批量转的吗 |
![]() | 5 likeunix 2022-02-28 15:12:36 +08:00 Ctrl+C and Ctrl+V |
![]() | 6 jim9606 2022-02-28 15:15:47 +08:00 ![]() 命令行 iconv ,支持任意方向的编码转码。 |
![]() | 7 xuanbg 2022-02-28 16:42:56 +08:00 vscode 可以用 编码打开,然后保存为任意编码 |
![]() | 8 AllenHua 2022-02-28 17:15:04 +08:00 啊这,np++ 也可 |
![]() | 9 imn1 2022-02-28 17:31:16 +08:00 单文件现代编辑器基本都可以,打开再同名另存选编码就行 批量的也有不少工具,搜搜就见到 |
![]() | 10 shawndev 2022-02-28 17:33:02 +08:00 iconv |
11 MrEatChicken OP ![]() 感谢各位,已经用 iconv 了,写了个 shell 脚本 有需要的可以拿去用 #! /bin/bash function read_dir(){ #iconv *.h -f -t UTF-8 -o *.h for file in `ls $1` #注意此处这是两个反引号,表示运行系统命令 do if [ -d $1"/"$file ] #注意此处之间一定要加上空格,否则会报错 then echo menu $1"/"$file read_dir $1"/"$file else if [ "${file##*.}"x = "h"x ]||[ "${file##*.}"x = "cpp"x ];then #只转.h 和.cpp 的文件 iconv $1"/"$file -f -t UTF-8 -o $1"/"$file # 转换 UTF-8 echo $1"/"$file fi fi done } #读取第一个参数 read_dir $1 |