Symisc Systems

Libcox Command Reference


Star Follow @symisc

Command Syntax

html_escape string [flags = ENT_COMPAT | ENT_IGNORE]


Alias

None


Description

HTML escaping of special characters. The translations performed are:
'&' (ampersand) : '&'
'"' (double quote) : '"' when ENT_NOQUOTES is not set.
"'" (single quote) : ''' only when ENT_QUOTES is set.
'<' (less than) : '&lt;'
'>' (greater than) : '&gt;'.


Parameters

string

The string being converted.

flags

Optional Parameter: A bitmask of one or more of the following flags, which specify how to handle quotes.
The default is ENT_COMPAT | ENT_IGNORE.
ENT_COMPAT 1 Will convert double-quotes and leave single-quotes alone.
ENT_QUOTES 2 Will convert both double and single quotes.
ENT_NOQUOTES 4 Will leave both double and single quotes unconverted.
ENT_IGNORE 64 Silently discard invalid code unit sequences instead of returning an empty string.


Return Value

String: The escaped string or NULL on failure. Use libcox_value_to_string() to extract the processing result.