SPEncode.ScriptEncode Method

Encodes a string for use in script.

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 ScriptEncode ( _
    str As String _
) As String
'Usage
Dim str As String
Dim returnValue As String

returnValue = SPEncode.ScriptEncode(str)
public static string ScriptEncode(
    string str
)

Parameters

Return Value

Type: System.String
An encoded string for use in script.

Remarks

The ScriptEncode method escapes characters that would otherwise conflict with script. This method makes character replacements as shown in the following table.

Original

Replacement

"

\"

+

\u002b

\

\\

'

\u0027

>

\u003e

<

\u003c

See Also

Reference

SPEncode Class

SPEncode Members

Microsoft.SharePoint.Utilities Namespace