EscapeHTML function

Syntax

EscapeHTML(text_string)

Description

Use the EscapeHTML function to replace the characters in text_string that would otherwise be interpreted as HTML markup.

For example, this function can be used with strings that are displayed in an HTML area or strings that are re-purposed to form a portion of URL parameters. The characters that are replaced are ones that would cause the browser to interpret them as HTML tags or other markup if they aren't encoded. Therefore, pre-formatted HTML should not be passed to this function unless the output desired is a rendering of the HTML code itself as opposed to its interpretation. This function is intended to make the text "browser safe."

Either HTML character entities (for example, <) or numeric character representations (for example, ') are output by the EscapeHTML function, depending on the character passed.

In addition to escaping characters that could be misinterpreted as HTML tags or other elements, EscapeHTML escapes the percentage sign (%) as this could interfere with PeopleCode-specific meta-HTML processing. Since all HTML in a PeopleSoft system is generated in Unicode, it is not necessary to escape other Unicode characters—their value may be passed directly to the browser instead of as a character entity or in numeric character representation.

The following table lists the Unicode characters that are escaped by the EscapeHTML function:

Unicode Character Name Glyph Escape Sequence

Quotation mark

"

"

Ampersand

&

&

Less than sign

<

&lt;

Apostrophe, single quote

'

&#039;

Percentage sign

%

&#037;

New line

Not applicable

<BR>

Parameters

Parameter Description

text_string

Specify a text string that contains characters that must be replaced with HTML escape sequences.

Returns

A string value.