Sdílet prostřednictvím


IDN.ToASCII Method

Definition

Overloads

ToASCII(String)

Translates a string from Unicode to ASCII Compatible Encoding (ACE), as defined by the ToASCII operation of RFC 3490.

ToASCII(String, IDNFlags)

Translates a string from Unicode to ASCII Compatible Encoding (ACE), as defined by the ToASCII operation of RFC 3490.

ToASCII(String)

Translates a string from Unicode to ASCII Compatible Encoding (ACE), as defined by the ToASCII operation of RFC 3490.

[Android.Runtime.Register("toASCII", "(Ljava/lang/String;)Ljava/lang/String;", "")]
public static string? ToASCII (string? input);
[<Android.Runtime.Register("toASCII", "(Ljava/lang/String;)Ljava/lang/String;", "")>]
static member ToASCII : string -> string

Parameters

input
String

the string to be processed

Returns

the translated String

Attributes

Exceptions

if input does not conform to

Remarks

Translates a string from Unicode to ASCII Compatible Encoding (ACE), as defined by the ToASCII operation of RFC 3490.

This convenience method works as if by invoking the two-argument counterpart as follows: <blockquote> #toASCII(String, int) toASCII(input,&nbsp;0); </blockquote>

Java documentation for java.net.IDN.toASCII(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ToASCII(String, IDNFlags)

Translates a string from Unicode to ASCII Compatible Encoding (ACE), as defined by the ToASCII operation of RFC 3490.

[Android.Runtime.Register("toASCII", "(Ljava/lang/String;I)Ljava/lang/String;", "")]
public static string? ToASCII (string? input, Java.Net.IDNFlags flag);
[<Android.Runtime.Register("toASCII", "(Ljava/lang/String;I)Ljava/lang/String;", "")>]
static member ToASCII : string * Java.Net.IDNFlags -> string

Parameters

input
String

the string to be processed

flag
IDNFlags

process flag; can be 0 or any logical OR of possible flags

Returns

the translated String

Attributes

Exceptions

if input does not conform to

Remarks

Translates a string from Unicode to ASCII Compatible Encoding (ACE), as defined by the ToASCII operation of RFC 3490.

ToASCII operation can fail. ToASCII fails if any step of it fails. If ToASCII operation fails, an IllegalArgumentException will be thrown. In this case, the input string should not be used in an internationalized domain name.

A label is an individual part of a domain name. The original ToASCII operation, as defined in RFC 3490, only operates on a single label. This method can handle both label and entire domain name, by assuming that labels in a domain name are always separated by dots. The following characters are recognized as dots: &#0092;u002E (full stop), &#0092;u3002 (ideographic full stop), &#0092;uFF0E (fullwidth full stop), and &#0092;uFF61 (halfwidth ideographic full stop). if dots are used as label separators, this method also changes all of them to &#0092;u002E (full stop) in output translated string.

Java documentation for java.net.IDN.toASCII(java.lang.String, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to