Iconv recursive file encoding change from CP1251 to UTF-8

find . -type f -exec sh -c '
  file="$0";
  iconv -f CP1251 -t UTF-8 "$file" > "$file.converted" && \
  mv -f "$file.converted" "$file"
' {} \;

If you were re-encoding html files than change your meta tag

#replace 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

#with
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Leave a Reply