NaviServer - programmable web server

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_quotehtml(n) 4.99.19 naviserver "NaviServer Built-in Commands"

Name

ns_quotehtml - Escape HTML characters so they appear as-is in HTML pages

Table Of Contents

Synopsis

Description

Returns the contents of HTML with certain characters that are special in HTML replaced with an escape code. The resulting text can be literally displayed in a webpage with an HTML renderer. Specifically:

& becomes &

< becomes &lt;

> becomes &gt;

' becomes &#39;

" becomes &#34;

All other characters are unmodified in the output.

COMMANDS

ns_quotehtml html

EXAMPLES

   % ns_quotehtml "Hello World!"
   Hello World!
   % ns_quotehtml "The <STRONG> tag is used to indicate strongly emphasized text."
   The &lt;STRONG&gt; tag is used to indicate strongly emphasized text.
   % ns_quotehtml {<span class="foo">}
   &lt;span class=&#34;foo&#34;&gt;

NOTES The set of characters that are substituted and their replacements may be different in previous versions of NaviServer. For example, NaviServer 2.x did not escape single or double-quotes.

Keywords

HTML, encoding, global built-in