diff --git a/question/bank/viewquestiontext/classes/question_text_row.php b/question/bank/viewquestiontext/classes/question_text_row.php
index 998c777f275d7..863a110d67b7d 100644
--- a/question/bank/viewquestiontext/classes/question_text_row.php
+++ b/question/bank/viewquestiontext/classes/question_text_row.php
@@ -58,8 +58,8 @@ protected function display_content($question, $rowclasses): void {
if ($this->preference !== question_text_format::OFF) {
$text = '';
if ($this->preference === question_text_format::PLAIN) {
- $text = question_utils::to_plain_text($question->questiontext,
- $question->questiontextformat, ['noclean' => true, 'para' => false, 'filter' => false]);
+ $text = s(question_utils::to_plain_text($question->questiontext,
+ $question->questiontextformat, ['noclean' => true, 'para' => false, 'filter' => false]));
} else if ($this->preference === question_text_format::FULL) {
$text = question_rewrite_question_preview_urls($question->questiontext, $question->id,
$question->contextid, 'question', 'questiontext', $question->id,
diff --git a/question/bank/viewquestiontext/tests/behat/view_question_text_column.feature b/question/bank/viewquestiontext/tests/behat/view_question_text_column.feature
index 995598f78bfec..fc6532199218c 100644
--- a/question/bank/viewquestiontext/tests/behat/view_question_text_column.feature
+++ b/question/bank/viewquestiontext/tests/behat/view_question_text_column.feature
@@ -13,26 +13,26 @@ Feature: Use the qbank plugin manager page for viewquestiontext
| contextlevel | reference | name |
| Course | C1 | Test questions |
And the following "questions" exist:
- | questioncategory | qtype | name | questiontext |
- | Test questions | truefalse | First question | Answer the first question |
+ | questioncategory | qtype | name | questiontext |
+ | Test questions | truefalse | First question | Answer the first <question> |
@javascript
Scenario: Display of plain question text can be turned on and off
When I am on the "Test quiz" "mod_quiz > question bank" page logged in as admin
And I set the field "Show question text in the question list?" to "text only"
- Then I should see "Answer the first question"
- And ".totestforhtml" "css_element" should not exist in the "Answer the first question" "table_row"
+ Then I should see "Answer the first "
+ And ".totestforhtml" "css_element" should not exist in the "Answer the first " "table_row"
And I set the field "Show question text in the question list?" to "No"
- And I should not see "Answer the first question"
+ And I should not see "Answer the first "
@javascript
Scenario: Display of full question text can be turned on and off
When I am on the "Test quiz" "mod_quiz > question bank" page logged in as admin
And I set the field "Show question text in the question list?" to "with images"
- Then I should see "Answer the first question"
- And ".totestforhtml" "css_element" should exist in the "Answer the first question" "table_row"
+ Then I should see "Answer the first "
+ And ".totestforhtml" "css_element" should exist in the "Answer the first " "table_row"
And I set the field "Show question text in the question list?" to "No"
- And I should not see "Answer the first question"
+ And I should not see "Answer the first "
@javascript
Scenario: Option does not show if the plugin is disabled
@@ -54,4 +54,4 @@ Feature: Use the qbank plugin manager page for viewquestiontext
And I click on "Enable" "link" in the "View question text" "table_row"
And I am on the "Test quiz" "mod_quiz > question bank" page
When I set the field "Show question text in the question list?" to "text only"
- And I should see "Answer the first question"
+ And I should see "Answer the first "