4.6.x common.inc decode_entities($text, $exclude = array())
4.7.x unicode.inc decode_entities($text, $exclude = array())
5.x unicode.inc decode_entities($text, $exclude = array())
6.x unicode.inc decode_entities($text, $exclude = array())
7.x unicode.inc decode_entities($text)

Decodes all HTML entities (including numerical ones) to regular UTF-8 bytes.

Double-escaped entities will only be decoded once ("&amp;lt;" becomes "&lt;" , not "<"). Be careful when using this function, as decode_entities can revert previous sanitization efforts (&lt;script&gt; will become <script>).


$text: The text to decode entities in.

Return value

The input $text, with all HTML entities decoded once.

13 calls to decode_entities()
comment_submit in modules/comment/comment.module
Prepare a comment for submission.
DrupalWebTestCase::checkForMetaRefresh in modules/simpletest/drupal_web_test_case.php
Check for meta refresh tag and if found call drupalGet() recursively. This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive.
FilterUnitTestCase::assertNoNormalized in modules/filter/filter.test
Asserts that text transformed to lowercase with HTML entities decoded does not contain a given string.
FilterUnitTestCase::assertNormalized in modules/filter/filter.test
Asserts that a text transformed to lowercase with HTML entities decoded does contains a given string.
filter_xss_bad_protocol in includes/common.inc
Processes an HTML attribute value and strips dangerous protocols from URLs.

... See full list


includes/unicode.inc, line 462
Provides Unicode-related conversions and operations.


function decode_entities($text) {
  return html_entity_decode($text, ENT_QUOTES, 'UTF-8');


ranelpadon’s picture

naveenvalecha’s picture

This function has been moved to String utility Component

edurenye’s picture

Not anymore, now this function has been moved to Html utility Component: