Skip to content

Instantly share code, notes, and snippets.

@kurdin
Created September 14, 2019 23:38
Show Gist options
  • Save kurdin/db53291407a40bafe430a3b6d9b3df8a to your computer and use it in GitHub Desktop.
Save kurdin/db53291407a40bafe430a3b6d9b3df8a to your computer and use it in GitHub Desktop.
win1251 to utf-8
find ./ -name "*.php" -o -name "*.htm" -o -name "*.html" -o -name "*.css" -o -name "*.js" -o -name "*.txt" -type f |
while read file
do
if ! file -bi $file | grep -q 'utf-8'
then
echo " $file"
mv "$file" "$file".icv
iconv -f WINDOWS-1251 -t UTF-8 "$file".icv > "$file"
rm -f "$file".icv
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment