HTML_ENTITY_ENCODE
The HTML_ENTITY_ENCODE scalar function converts a string into a string with HTML entities.
- string-expression
- A string expression that returns a built-in character string. The string will be converted to a varying length character string in CCSID 1208 before encoding.
The result of the function is a varying length character string with a CCSID of 1208 in which HTML entities have been encoded.
The following rules are used for the encoding:
- <, >, &, ", and ' are converted into <, >, &, ", and '.
- The horizontal tabulation (HT or UX'0009'), line feed (LF or UX'000A'), and carriage return (CR or UX'000D') control characters are unchanged.
- The remaining non-control characters that can be represented in 7-bit ASCII are unchanged.
- All other characters are converted to HTML entities of the form &#xXXXX where XXXX is the hexadecimal value of the character.
Example
- Encode a string containing & < > ' and
"
ReturnsVALUES HTML_ENTITY_ENCODE('&<>''"')
&<>'"
- Encode a string containing UNICODE
values.
ReturnsVALUES HTML_ENTITY_ENCODE(UX'0E010E230E380E130E320E420E170E230E2B0E320E090E310E19')
กรุณาโทรหาฉัน