SPHttpUtility.HtmlEncodeAllowSimpleTextFormatting Method (String)
Encodes the specified string for use as text between HTML tags, preserving spaces in the original string and allowing simple text formatting.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
Syntax
'Declaration
Public Shared Function HtmlEncodeAllowSimpleTextFormatting ( _
valueToEncode As String _
) As String
'Usage
Dim valueToEncode As String
Dim returnValue As String
returnValue = SPHttpUtility.HtmlEncodeAllowSimpleTextFormatting(valueToEncode)
public static string HtmlEncodeAllowSimpleTextFormatting(
string valueToEncode
)
Parameters
valueToEncode
Type: System.StringThe string to encode.
Return Value
Type: System.String
The encoded string.
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 carriage-return characters with space characters.
"<br>", "<b>", "<i>", "<u>", "</b>", "</i>", and "</u>" HTML tags and "&nbsp;" entity references in the specified string are permitted and not encoded. These allowed HTML tags and entity reference are case sensitive.