// Define a string containing HTML entities $encodedString = '<p>This text contains <html> entities.</p>'; // Decode the string using Drupal's html decodeEntities function $decodedString = \Drupal\Component\Utility\Html::decodeEntities($encodedString); // Output the decoded string echo $decodedString;In this example, we have a string containing HTML entities. We pass this string through the Html decodeEntities function to decode the HTML entities to their respective unicode characters. The resulting string is then output using the echo statement. The Html decodeEntities function is part of Drupal's Component Utility library.