Posted By

Dorgendubal on 02/28/09


Bash utf-8 encoding iconv

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Convert encoding of all matching files in directory and sub-directories

 / Published in: Bash

Useful to convert all matching files from one encoding to another. Some examples:

  1. find -name "PATTERN" -exec iconv --from-code=ENCODING_1 --to-code=ENCODING_2 '{}' -o '{}' \;
  2. find -name "*.php" -exec iconv --from-code=ISO8859-1 --to-code=UTF-8 '{}' -o '{}' \;
  3. find -regex ".*transl.*\.txt" -exec iconv --from-code=ISO8859-1 --to-code=UTF-8 '{}' -o '{}' \;

Report this snippet  

You need to login to post a comment.