Results of my tests using the 3 patch files proposed by Tim.
This is the exact text I have used in my multianswer/cloze type question for my tests:
In this multianswer question text we have 3 backslashes \\\ followed by {curled braces} <angle brackets> and 3 non-breaking spaces & finally one non?breaking hyphen. The SHORTANSWER sub-questions contains an apostrophe in the Correct answer text: John's book and apostrophes and double quotes in the feedback to that Correct answer: Yes, "John's book" is the correct answer.{1:SHORTANSWER:=John's book#Yes, "John's book" is the correct answer~*No, try again}.
Results
1- The non-breaking space no longer crashes the cloze questions; the backslashes are correctly displayed, even upon re-editing the question; angle brackets remain angle brackets (i.e. their contents is no longer interpreted as HTML tags), curled braces are OK. Everything is OK in 1.6, 1.7 and 1.8 versions.
2- When apostrophes or double quotes are used in the Feedback text of the sub-questions.
a- apostrophes are displayed OK in all versions
b- double quotes are displayed OK in 1.7 and 1.8 (not in 1.6)
c- when a cloze question with apostrophes or double quotes in one of its feedback messages is exported/imported (Moodle XML format), upon importing the question, the feedback message is no longer displayed. However, it will be correctly displayed if one edits the question (in fact, just edit and save, nothing must be changed). Weird.
3- There remains a bug I mentioned quite some time ago: SHORTANSWER sub-questions cannot have apostrophes or double-quotes in their ANSWER text
a- the apostrophe case: a backslash is added upon clicking Fill with correct in Question preview mode (see attached screenshot)
b- the double quote case: the double quotes are transformed into their HTML entity name!
NOTE.- Unfortunately it seems that the contents of SHORTANSWER sub-questions ANSWERS is strictly limited to text.
I had found a solution for the apostrophe, and will try to find it again, based on the patches now proposed by Tim in the present bug report.
NOTE.- I have not tested these patches with LaTex expressions in the Cloze question text because I never use LaTex and I am not able to make it work on my local Moodle server.
Joseph
Originally, it is mentioned that the issue affects version 1.6.1 but I have noticed it in 1.7 as well.