Created
August 30, 2021 16:57
-
-
Save progmult/3feb0f41d9b53b6170b63fbdb37910f9 to your computer and use it in GitHub Desktop.
convert_utf8.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# convert windows-1251 files to utf-8 in folder recursive. | |
# creates "_backup" folder with original files | |
# check if file is already encoded | |
for f in $(find . -name "*.css"); | |
do | |
if file --mime-encoding $f | grep -wqe "iso-8859-1" -e "unknown-8bit" | |
then | |
mkdir -p _backup/$(dirname ${f}) | |
cp $f ./_backup/$(dirname ${f}) | |
iconv -f cp1251 -t utf8 $f > "${filename}_utf8.tmp" | |
mv "${filename}_utf8.tmp" $f | |
echo $f": CONVERTED TO UTF-8." | |
else | |
echo $f": UTF-8 ALREADY." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment