From 38b3ebd109fa04963caf204a38c44af58016e7c4 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Thu, 13 Mar 2025 12:08:34 +0100
Subject: [PATCH] Fix test for files with non ASCII characters

The previous check was to general since it catched also files were non ASCII
characters are allowed (e.g. Latex files).
Now test only for source code files and check for files which are of
non ASCII type.
---
 scripts/check-non-ascii-characters.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/check-non-ascii-characters.sh b/scripts/check-non-ascii-characters.sh
index d4778a925..9fadd43a9 100755
--- a/scripts/check-non-ascii-characters.sh
+++ b/scripts/check-non-ascii-characters.sh
@@ -20,9 +20,12 @@ fi
 echo "Upstream name is :" $UPSTREAM
 
 BASE_COMMIT=$UPSTREAM/master
-CHANGED_FILES=$(git diff --name-only $BASE_COMMIT)
+# check only source code files
+CHANGED_FILES=$(git diff --name-only $BASE_COMMIT | grep -E '.*\.(h|hpp|c|C|cpp|cxx|tpl)$' | grep -viE '.*LinkDef.h$')
+
 for file in $CHANGED_FILES; do
-  result=$(file $file | grep UTF-8)
+  # find all source code files which are non ASCII ones
+  result=$(file $file | grep -v ASCII)
   if [[ "$result" != "" ]]; then
     echo " "
     echo "File $file contains non ASCII characters"
-- 
GitLab