HTMLEncode Method

Applies To   See Also  

The HTMLEncode method ensures that any HTML, or text that appears similar, will be output to the page as it appears and will not be interpreted by the browser as HTML. (Returns String.)

Syntax

Set Text = Server.HTMLEncode (Str)

Parts

Text

The encoded string.

Str

The string to be encoded.

Remarks

To avoid the browser confusing HTML code with text that has HTML elements in it, always use this method before writing text that contains special HTML characters to the page.

For example, consider the following line:

Response.Write HTMLEncode("<B>This is not bold</B>")

The browser will display this line like so:

<B>This is not bold</B>

However, the following line of code will produce a different result.

Response.Write "<B>This is bold</B>"

This line will be displayed like so:

This is bold.



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com