util_expand_entities (public, deprecated)

 util_expand_entities html

Defined in packages/acs-tcl/tcl/text-html-procs.tcl

Deprecated. Invoking this procedure generates a warning.

Replaces all occurrences of common HTML entities with their plaintext equivalents in a way that's appropriate for pretty-printing.

Currently, the following entities are converted: <, >, &apm;quot;, &, — and —.

This proc is more suitable for pretty-printing that its sister-proc, util_expand_entities_ie_style. The two differences are that this one is more strict: it requires proper entities i.e., both opening ampersand and closing semicolon, and it doesn't do numeric entities, because they're generally not safe to send to browsers. If we want to do numeric entities in general, we should also consider how they interact with character encodings.

Parameters:
html (required)
See Also:
  • ns_unquotehtml

Partial Call Graph (max 5 caller/called nodes):
%3 ad_log_deprecated ad_log_deprecated (public) util_expand_entities util_expand_entities util_expand_entities->ad_log_deprecated

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc util_expand_entities
    regsub -all -- {&lt;} $html {<} html
    regsub -all -- {&gt;} $html {>} html
    regsub -all -- {&quot;} $html "\"" html
    regsub -all -- {&mdash;} $html {--} html
    regsub -all -- {&#151;} $html {--} html
    # Need to do the &amp; last, because otherwise it could interfere with the other expansions,
    # e.g., if the text said &amp;lt;, that would be translated into <, instead of &lt;
    regsub -all -- {&amp;} $html {\&} html
    return $html
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: