Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion main/exercise/fill_blanks.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Loading