HTML_DECODE function [Miscellaneous]

Decodes special character entities that appear in HTML literal strings.

Syntax

HTML_DECODE( string )

Parameters

Returns

LONG VARCHAR or LONG NVARCHAR.

Note: The result data type is a LONG VARCHAR. If you use HTML_DECODE in a SELECT INTO statement, you must have an Unstructured Data Analytics Option license or use CAST and set HTML_DECODE to the correct data type and size.

Remarks

This function returns the string argument after making the appropriate substitutions. The following table contains a sampling of the acceptable character entities.

Characters Substitution
" "
' '
& &
&lt; <
&gt; >
&#xhexadecimal-number; Unicode codepoint, specified as a hexadecimal number. For example, &#x27; returns a single apostrophe.
&#decimal-number; Unicode codepoint, specified as a decimal number. For example, &#8482; returns the trademark symbol.

When a Unicode codepoint is specified, if the value can be converted to a character in the database character set, it is converted to a character. Otherwise, it is returned uninterpreted.

SAP Sybase IQ supports all character entity references specified in the HTML 4.01 Specification. See http://www.w3.org/TR/html4/ and http://www.w3.org/TR/html4/sgml/entities.html#h-24.2.

Standards and compatibility

Examples

The following statement returns the string <p>The piano was made for 'Steinway & Sons'.</p>:

SELECT HTML_DECODE('&lt;p&gt;The piano was made ' ||
  'by &lsquo;Steinway &amp; Sons&rsquo;.&lt;/p&gt;')

The following statement returns the string <p>It cost €85.000,000. </p>:

SELECT HTML_DECODE('&lt;p&gt;It cost &euro;85.000,000.&lt;/p&gt;')