1
0
mirror of synced 2024-11-24 22:36:07 +03:00

exit for encoding error (#107)

This commit is contained in:
Akolzin Dmitry 2020-05-18 11:53:03 +03:00 committed by GitHub
parent 5521b7fd82
commit 50caf0240f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,8 +30,12 @@ echo "Update version and date in the file \"version.php\""
for i in `find ./"$version" -type f -name '*.*'`; do
encoding=`file -b --mime-encoding "$i"`
if [ "$encoding" != "iso-8859-1" ] && [ "$encoding" != "binary" ]; then
iconv -c -f $encoding -t "cp1251" $i >> $i.cp1251
mv $i.cp1251 $i
result=$(iconv -f $encoding -t "cp1251" $i -o $i.cp1251 2>&1 > /dev/null)
if [ ! -z "$result" ]; then
echo "Errors in file $i"
echo $result
exit 255
fi
fi
done
echo "Encoding the file has changed"