Uri.EscapeString(String) Uri.EscapeString(String) Uri.EscapeString(String) Uri.EscapeString(String) Method

定义

警告

此 API 现已过时。

将字符串转换为它的转义表示形式。Converts a string to its escaped representation.

protected:
 static System::String ^ EscapeString(System::String ^ str);
[System.Obsolete("The method has been deprecated. Please use GetComponents() or static EscapeUriString() to escape a Uri component or a string. http://go.microsoft.com/fwlink/?linkid=14202")]
[System.Obsolete("The method has been deprecated. Please use GetComponents() or static EscapeUriString() to escape a Uri component or a string. https://go.microsoft.com/fwlink/?linkid=14202")]
protected static string EscapeString (string str);
static member EscapeString : string -> string
Protected Shared Function EscapeString (str As String) As String

参数

str
String String String String

要转换为它的转义表示形式的字符串。The string to transform to its escaped representation.

返回

字符串的转义表示形式。The escaped representation of the string.

注解

EscapeString方法将 RFC 2396 保留字符和字符值大于 127 的所有字符转换为十六进制表示形式。The EscapeString method converts RFC 2396 reserved characters and all characters with a character value greater than 127 to hexadecimal representation. 转义之前,所有 Unicode 字符都转换为 utf-8 格式。All Unicode characters are converted to UTF-8 format before being escaped.

默认情况下,根据 RFC 2396 转义字符串。By default, the string is escaped according to RFC 2396. 如果启用了国际资源标识符 (Iri) 或国际化域名 (IDN) 分析,根据 RFC 3986 和 RFC 3987 转义字符串。If International Resource Identifiers (IRIs) or Internationalized Domain Name (IDN) parsing is enabled, the string is escaped according to RFC 3986 and RFC 3987.

IRI 支持的详细信息,请参阅备注部分Uri类。For more information on IRI support, see the Remarks section for the Uri class.

适用于