diff --git a/core/templates/core/feedback_form.html b/core/templates/core/feedback_form.html
index 128ae2661947290f3e3435adcfd4b8c83ed81c68..6adda232370a524699c2badbcf9a5fc17634a8e8 100644
--- a/core/templates/core/feedback_form.html
+++ b/core/templates/core/feedback_form.html
@@ -119,7 +119,6 @@
     {% include "core/message_box.html" %}
   </div>
 </div>
-
 </div>
 </div>
 
@@ -159,7 +158,7 @@
 
   // we need this one for the student readonly
   var editor_student = ace.edit("student_text");
-  editor_student.setValue(`{{feedback.of_submission.text|safe}}`, -1);
+  editor_student.setValue(`{{feedback.of_submission.text|safe|escapejs}}`, -1);
   editor_student.getSession().setMode("ace/mode/c_cpp");
   editor_student.setOptions({
     readOnly: true,
@@ -170,7 +169,7 @@
   var editor_tutor = ace.edit("tutor_text");
   var textarea = $('textarea[id="id_text"]');
   editor_tutor.focus();
-  editor_tutor.setValue(`{{feedback.text|safe}}`, -1);
+  editor_tutor.setValue(`{{feedback.text|safe|escapejs}}`, -1);
   editor_tutor.getSession().setUseWrapMode(true)
   editor_tutor.getSession().on("change", function () {
     textarea.val(editor_tutor.getSession().getValue());