glib

Function hostname_is_ascii_encoded

Source
pub fn hostname_is_ascii_encoded(hostname: &str) -> bool
Expand description

Tests if @hostname contains segments with an ASCII-compatible encoding of an Internationalized Domain Name. If this returns true, you should decode the hostname with g_hostname_to_unicode() before displaying it to the user.

Note that a hostname might contain a mix of encoded and unencoded segments, and so it is possible for g_hostname_is_non_ascii() and g_hostname_is_ascii_encoded() to both return true for a name.

§hostname

a hostname

§Returns

true if @hostname contains any ASCII-encoded segments. Tests if @hostname contains segments with an ASCII-compatible encoding of an Internationalized Domain Name. If this returns true, you should decode the hostname with g_hostname_to_unicode() before displaying it to the user.

Note that a hostname might contain a mix of encoded and unencoded segments, and so it is possible for g_hostname_is_non_ascii() and g_hostname_is_ascii_encoded() to both return true for a name.

§hostname

a hostname

§Returns

true if @hostname contains any ASCII-encoded segments.