Index: questiontype.php
===================================================================
RCS file: /cvsroot/moodle/moodle/question/type/match/questiontype.php,v
retrieving revision 1.63
diff -u -r1.63 questiontype.php
--- questiontype.php	21 Sep 2010 08:20:48 -0000	1.63
+++ questiontype.php	27 Sep 2010 15:30:15 -0000
@@ -260,10 +260,11 @@
         // Prepare a list of answers, removing duplicates.
         foreach ($subquestions as $subquestion) {
             foreach ($subquestion->options->answers as $ans) {
-                $allanswers[$ans->id] = $ans->answer;
-                if (!in_array($ans->answer, $answers)) {
-                    $answers[$ans->id] = strip_tags(format_string($ans->answer, false));
-                    $answerids[$ans->answer] = $ans->id;
+                $formattedanswer = strip_tags(format_string($ans->answer, false));
+                $allanswers[$ans->id] = $formattedanswer;
+                if (!in_array($formattedanswer, $answers)) {
+                    $answers[$ans->id] = $formattedanswer;
+                    $answerids[$formattedanswer] = $ans->id;
                 }
             }
         }
@@ -358,7 +359,7 @@
                     // two answers with the same text, but different ids,
                     // so we need to try matching the answer text.
                     $expected_answer = reset($sub->options->answers);
-                    if ($answertexts[$response] == $expected_answer->answer) {
+                    if ($answertexts[$response] == strip_tags(format_string($expected_answer->answer, false))) {
                         $response = $expected_answer->id;
                     }
                 }
