다음을 통해 공유


SPEncode.UrlEncodeAsUrl Method (String, Boolean)

Encodes the specified string, converting special characters to quoted UTF-8 format, but assumes that the string is a path component of a URL and encodes Unicode characters only if the encodeUnicodeCharacters parameter is true.

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 UrlEncodeAsUrl ( _
    str As String, _
    encodeUnicodeCharacters As Boolean _
) As String
'Usage
Dim str As String
Dim encodeUnicodeCharacters As Boolean
Dim returnValue As String

returnValue = SPEncode.UrlEncodeAsUrl(str, _
    encodeUnicodeCharacters)
public static string UrlEncodeAsUrl(
    string str,
    bool encodeUnicodeCharacters
)

Parameters

  • encodeUnicodeCharacters
    Type: System.Boolean

    true to encode Unicode characters; otherwise, false.

Return Value

Type: System.String
The encoded string.

Remarks

Unlike the UrlEncode method, the UrlEncodeAsUrl method does not encode the forward slash ("/").

See Also

Reference

SPEncode Class

SPEncode Members

UrlEncodeAsUrl Overload

Microsoft.SharePoint.Utilities Namespace