MDL-37157: Normalize short answers before comparison
[moodle.git] / question / type / shortanswer / question.php
index 5e7626b..d46f4e0 100644 (file)
@@ -102,6 +102,11 @@ class qtype_shortanswer_question extends question_graded_by_strategy
             $regexp .= 'i';
         }
 
+        if (function_exists('normalizer_normalize')) {
+            $regexp = normalizer_normalize($regexp, Normalizer::FORM_C);
+            $string = normalizer_normalize($string, Normalizer::FORM_C);
+        }
+
         return preg_match($regexp, trim($string));
     }