Share via


HtmlEncode Method

The HtmlEncode method of the SPEncode class encodes the specified string so that special characters used in HTML are encoded as HTML entities.

Parameters

str   The string to encode.

Return Value

The encoded version of the string that is passed to the method.

Remarks

The HtmlEncode method converts characters to entities as follows:

  • < to &lt;
  • > to &gt;
  • & to &amp;
  • " to &quot;
  • ' to &#39;

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security