diff --git a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
index 21803ce..d684627 100644
--- a/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
+++ b/core/modules/views/src/Plugin/views/field/FieldPluginBase.php
@@ -1214,7 +1214,7 @@ public function renderText($alter) {
     // alterations made by this method. Any alterations or replacements made
     // within this method need to ensure that at the minimum the result is
     // XSS admin filtered. See self::renderAltered() as an example that does.
-    $value_is_safe = $this->last_render instanceof MarkupInterface;
+    $value_is_safe = $this->last_render instanceof MarkupInterface || (string) $this->last_render === '';
     // Cast to a string so that empty checks and string functions work as
     // expected.
     $value = (string) $this->last_render;
diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
index 9672dc2..a43cb1d 100644
--- a/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php
@@ -261,11 +261,19 @@ public function testRenderTrimmedWithMoreLink() {
   /**
    * Tests the "No results text" rendering.
    *
+   * @param string $hide_alter_empty
+   *   The value for the "hide_alter_empty" field option.
+   *
    * @covers ::renderText
+   *
+   * @dataProvider providerTestRenderNoResult
    */
-  public function testRenderNoResult() {
+  public function testRenderNoResult($hide_alter_empty) {
     $this->setupDisplayWithEmptyArgumentsAndFields();
-    $field = $this->setupTestField(['empty' => 'This <strong>should work</strong>.']);
+    $field = $this->setupTestField([
+      'empty' => 'This <strong>should work</strong>.',
+      'hide_alter_empty' => $hide_alter_empty,
+    ]);
     $field->field_alias = 'key';
     $row = new ResultRow(['key' => '']);
 
@@ -276,6 +284,13 @@ public function testRenderNoResult() {
   }
 
   /**
+   * Data provider for ::testRenderNoResult().
+   */
+  public function providerTestRenderNoResult() {
+    return [[TRUE], [FALSE]];
+  }
+
+  /**
    * Test rendering of a link with a path and options.
    *
    * @dataProvider providerTestRenderAsLinkWithPathAndOptions
