GLib.hostname_to_unicode

function hostname_to_unicode(hostname: String): String {
    // Gjs wrapper for g_hostname_to_unicode()
}
  

Converts hostname to its canonical presentation form; a UTF-8 string in Unicode normalization form C, containing no uppercase letters, no forbidden characters, and no ASCII-encoded segments, and not ending with a trailing dot.

Of course if hostname is not an internationalized hostname, then the canonical presentation form will be entirely ASCII.

Since 2.22

hostname

a valid UTF-8 or ASCII hostname

Returns

a UTF-8 hostname, which must be freed, or null if hostname is in some way invalid.