# Escaping is inconsistent in text input answers

## Description

I have a text input problem with "<P/2 M>" as expected result.

Now, when I use the studio to define the problem, I cannot get escaping right.
I have tried three alternatives in the <stringresponse answer="XXX" type="ci"> line:

1.

this does not work because angle brackets must be escaped.

2.

this accepts "<P/2 M>" as a valid input, but does not display correctly as an anwser (see below).

3.

(double escape) this does render correctly as an answer, but accepts only "&amp;lt;P/2 M&amp;gt;" as a valid input.

With this I get one correctly displayed answer, and I accept the required input.
Of course, I also get a "Answer: <P/2 M> or " with an empty alternative, and my text input problem accepts "&amp;lt;P/2 M&amp;gt;" as an answer.

The issue is that answer="&amp;lt;P/2 M&amp;gt;" is rendered as "<p 2="" m=""></p>" by the internal html sanitizer.

As an example, this is how the answer for the above problem is rendered in html:

PS: Please bear with me, and forgive errors in this report. To encode "&amp;amp;lt;P/2 M&amp;amp;gt;", I had to write "&amp;amp;amp;lt;P/2 M&amp;amp;amp;gt;" ...
PS2: And to write the above sentence, I had to write... Well, you get the idea

## Steps to Reproduce

<problem>
<!-- We need two different answers. -->
<!-- The first is escaped twice to ensure proper display in the "answer" section. -->
<!-- The second is escaped only once to match input from students. -->
<label>What is printed with: {Browse M}</label>
<description>Try to answer by yourself and then use Mozart to see if the result is the one you expected.</description>
<textline size="20"/>
</stringresponse>
<solution>
<div class="detailed-solution">
<p>Explanation</p>
<p>We have browsed M, a procedure of 2 arguments.</p>
</div>
</solution>
</problem>

None

None

None

None

None

Unassigned

## Reporter

Guillaume Maudoux

None

None

None

None

None

None

None

None

None

None

None

Unset
Configure