iconv-super 解决字符编码的转码问题-自动探测,文件夹转换

2017-05-20 16:32:24 +08:00
 dogHere

写了一个类似于 iconv 的字符转码软件,基本功能和它一样,另外支持自动探测编码格式,文件夹转换的功能。

举几个例子:

把一个文件(夹)里面的所有内容,从 big5 转到 utf-8:

./iconv-super -f big5 -t utf-8 -s math -d math-converted

-c,同时把非 big5 的文件 copy 到另一个文件夹:

./iconv-super -f big5 -t utf-8 -s math -d math-converted -c

-n,非 big5 的文件 copy 到另一个文件夹,但不转换 big5 文件:

./iconv-super -f big5 -t utf-8 -s math -d math-converted -c -n

-c,显示 log:

./iconv-super -f big5 -t utf-8 -s math -d math-converted -v

-r,正则匹配特定文件:

./iconv-super -f big5 -t utf-8 -s math -d math-converted -r .html

去掉-f,自动探测源文件编码:

./iconv-super -t utf-8 -s math -d math-converted

用管道:

cat file |./iconv-super -f big5 -t utf-8 

用管道,同时自动探测:

cat file |./iconv-super  -t utf-8 

项目地址:iconv-super.

如有变更,项目地址为准。

1575 次点击
所在节点    分享创造
2 条回复
v1024
2017-05-20 18:18:19 +08:00
显然应该叫 iconv-cli
dogHere
2017-05-21 00:12:05 +08:00
实际上已经存在了 iconv 这个命令,如果名字叫做 iconv-cli,没办法和 iconv 做区分。

本项目和 iconv 的区别在于,自动探测源文件编码,批量处理文件夹(比如文件夹中有各种编码的文件,还有音乐,视频等以及其他二进制文件,可以只转换需要转换的文本,选择性复制没有转换的文件,你很难写一个 bash 脚步结合 iconv 实现本功能),因此,本工具的能力是在 iconv 之上,叫 iconv-super 合情合理。

@v1024

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/362653

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX