How to change encoding in many files?

前端 未结 4 926
甜味超标
甜味超标 2020-12-17 03:10

I try this:

find . -exec iconv -f iso8859-2 -t utf-8 {} \\;

but output goes to the screen, not to the same file. How to do it?

4条回答
  •  时光说笑
    2020-12-17 03:55

    No one proposed a way to automatically detect encoding and recode.

    Here is an example to recode to UTF-8 all HTM/HTML files from master branch of a GIT.

    git ls-tree master -r --name-only | grep htm | xargs -n1 -I{} bash -c 'recode "$(file -b --mime-encoding {})..utf-8" {}'

提交回复
热议问题