SPHttpUtility.HtmlEncodeAllowSimpleTextFormatting Method (String, TextWriter)

Encodes the specified string for use as text between HTML tags, preserving spaces in the original string and allowing simple text formatting, and appends it to the specified output stream.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared Sub HtmlEncodeAllowSimpleTextFormatting ( _
    valueToEncode As String, _
    output As TextWriter _
)
'Usage
Dim valueToEncode As String
Dim output As TextWriterSPHttpUtility.HtmlEncodeAllowSimpleTextFormatting(valueToEncode, _
    output)
public static void HtmlEncodeAllowSimpleTextFormatting(
    string valueToEncode,
    TextWriter output
)

Parameters

Remarks

The HtmlEncodeAllowSimpleTextFormatting method:

  • Replaces ampersand, double-quotation, single-quotation, less-than, and greater-than characters with the appropriate entity references.

  • Replaces space characters preceded by a newline character or followed by another space character with " " entity references.

  • Replaces newline characters with HTML "<br>" tags.

  • Replaces carriage0return characters with space characters.

"<br>", "<b>", "<i>", "<u>", "</b>", "</i>", and "</u>" HTML tags and " " entity references in the specified string are permitted and not encoded. These allowed HTML tags and entity reference are case sensitive.

See Also

Reference

SPHttpUtility Class

SPHttpUtility Members

HtmlEncodeAllowSimpleTextFormatting Overload

Microsoft.SharePoint.Utilities Namespace