From 7ea8cc1f9857ca35cf543055bfb1f50a7851701a Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Mon, 23 Oct 2023 19:12:42 +0200 Subject: [PATCH] check_file_encoding --- resource/tools/check_file_encoding.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resource/tools/check_file_encoding.sh b/resource/tools/check_file_encoding.sh index 83daa40..1ec166e 100755 --- a/resource/tools/check_file_encoding.sh +++ b/resource/tools/check_file_encoding.sh @@ -4,9 +4,10 @@ if ! command -v recode >/dev/null; then echo "Please install 'recode' package first" ; exit 1 fi -echo "Files with suspicious chars:" -find . \( -not -path "./.git/*" -and -not -path "./firmware/nrf52_sdk/*" -and -not -path "./firmware/objects/*" -and -not -path "./software/script/venv/*" -and -not -path "./software/bin/*" -and -not -path "./software/src/tmp/*" \) -and \( -name "*.[ch]" -or -name "*.py" -or -name "Makefile" -or -name "*.txt" -or -name "*.md" -or -name "*.sh" \) -exec sh -c "cat {} |recode utf8.. >/dev/null || echo {}" \; +echo "Files with suspicious chars:" +find . \( -not -path "./.git/*" -and -not -path "./firmware/nrf52_sdk/*" -and -not -path "./firmware/objects/*" -and -not -path "./software/script/venv/*" -and -not -path "./software/bin/*" -and -not -path "./software/src/tmp/*" \) -and \( -name "*.[ch]" -or -name "*.py" -or -name "Makefile" -or -name "*.txt" -or -name "*.md" -or -name "*.sh" \) -exec sh -c "cat {} |recode utf8..ascii >/dev/null 2>&1 || ( echo \"\n{}:\"; cat {} |tr -d ' -~'|sed 's/\(.\)/\1\n/g'|sort|uniq|tr -d '\n' )" \; +echo # Chinese encoding: GB18030 extending EUC-CN # recode GB18030..UTF-8 file.c