From 256da57cacef46ed580177bb1e0558afab91fe3d Mon Sep 17 00:00:00 2001 From: DamienLyon Date: Tue, 16 Dec 2025 15:37:56 +0100 Subject: [PATCH] Remove invisible Unicode characters that can cause // Remove invisible Unicode characters that can cause comparison issues // U+200B = ZERO WIDTH SPACE // U+200C = ZERO WIDTH NON-JOINER // U+200D = ZERO WIDTH JOINER // U+FEFF = ZERO WIDTH NO-BREAK SPACE (BOM) --- main/exercise/fill_blanks.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main/exercise/fill_blanks.class.php b/main/exercise/fill_blanks.class.php index adcb63e83d0..c0e7ab7540c 100755 --- a/main/exercise/fill_blanks.class.php +++ b/main/exercise/fill_blanks.class.php @@ -1449,7 +1449,17 @@ public static function clearStudentAnswer($answer): string private static function trimOption($text) { $text = trim($text); - + + // Remove invisible Unicode characters that can cause comparison issues + // U+200B = ZERO WIDTH SPACE + // U+200C = ZERO WIDTH NON-JOINER + // U+200D = ZERO WIDTH JOINER + // U+FEFF = ZERO WIDTH NO-BREAK SPACE (BOM) + $text = str_replace("\u{200B}", '', $text); + $text = str_replace("\u{200C}", '', $text); + $text = str_replace("\u{200D}", '', $text); + $text = str_replace("\u{FEFF}", '', $text); + return preg_replace("/\s+/", ' ', $text); } }