Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
WebSpeed API Reference : html-encode
 

html-encode

This function converts various characters that can be misinterpreted as HTML formatting to their HTML entity representation. The characters <, >, & and " (double quote) are converted to &lt;, &gt;, &amp;, and &quot; respectively.

Location

web\method\cgiutils.i

Parameters

INPUT p_in AS CHARACTER
The character string to encode.

Returns

CHARACTER

Notes

This function cannot be called more than once on a string. This is because ampersands are replaced with &amp; and recursive calls will fail.

Examples

PROCEDURE displayFields:
\*-------------------------------------------------------------------------
Purpose: Override standard ADM method
-------------------------------------------------------------------------*\
RUN SUPER.
\* The comment field may contain <, >, quotes and ampersands. To be safe, convert these characters. *\
IF AVAILABLE Customer THEN
  Customer.Comments:SCREEN-VALUE IN FRAME {&FRAME-NAME} =
  html-encode(Customer.Comments).
END PROCEDURE.