Created
June 9, 2023 23:56
-
-
Save GabrielGuedess/97b96bb96535541c8a2002bd488d0e0e to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
find . -type f -name '*.cs' -exec bash -c ' | |
descr=$(file -b "$0") | |
if [[ $descr != *UTF-8* ]]; then | |
iconv -f CP1252 -t UTF-8 "$0" > "$0.$$" && mv "$0.$$" "$0" | |
elif [[ $descr == *"with BOM"* ]]; then | |
tail -c +4 "$0" > "$0.$$" && mv "$0.$$" "$0" | |
fi | |
' {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment