IBM Books

Reference

DTW_HTMLENCODE


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

Encodes selected characters using HTML character escape codes.

Format

@DTW_HTMLENCODE(stringIn, stringOut)

@DTW_rHTMLENCODE(stringIn)

Parameters

Table 39. DTW_HTMLENCODE Parameters

Data Type Parameter Use Description
string stringIn IN A variable or literal string.
string stringOut OUT A variable containing the modified input string in which certain characters have been replaced by the HTML character escape codes.

Return Codes

Table 40. DTW_HTMLENCODE Return Codes

Return Code Explanation
-1001 The server could not process a Net.Data request to allocate memory.
1003 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
1005 A parameter passed on a function call, required to be a string variable, was of a different variable type.
1006 A literal string was passed on a function call for a parameter which was required to be an output parameter.

Usage Notes

  1. Use this function to encode character data that you do not want the Web browser to interpret as HTML. For example, by using the appropriate escape code, you can display characters such as less-than (<) and greater-than (>) within a Web page, which would otherwise be interpreted by the browser as components of HTML tags.
  2. Table 41 shows the characters that are encoded by the DTW_HTMLENCODE function.

    Table 41. Character Escape Codes for HTML

    Character Name Code
    SPACE Space &#32;
    " Double quote &#34;
    # Number sign &#35;
    % Percent &#37;
    & Ampersand &#38;
    [ Left bracket &#40;
    ] Right bracket &#41;
    + Plus &#43;
    \ Slash &#47;
    : Colon &#58;
    ; Semicolon &#59;
    < Less than &#60;
    = Equals &#61:
    > Greater than &#62:
    ? Question mark &#63:
    @ At sign &#64;
    / Backslash &#92;
    ^ Carat &#94;
    { Left brace &#123;
    | Straight line &#124;
    } Right brace &#125;
    ~ Tilde &#126;

Examples

Example 1: Encodes the space character

@DTW_HTMLENCODE(string1,string2)

Example 2: Encodes spaces, the less-than sign, and the equal sign

@DTW_rHTMLENCODE("X <= 10")


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]