LinuxCommandLibrary

idn

Convert domain names between encodings

SYNOPSIS

idn [options] [domain-name]

PARAMETERS

--version
    Display version information and exit.

--help
    Display help text and exit.

-a, --to-ascii
    Convert a Unicode domain name to Punycode.

-d, --to-unicode
    Convert a Punycode domain name to Unicode.

-n, --no-nfkc
    Disable the use of NFKC normalization.

-P, --profile
    Specify the IDNA profile to use (e.g., "2003", "2008", or "transitional"). Defaults to IDNA2008.

-q, --quiet
    Suppress all output, except for errors.

-v, --verbose
    Be verbose.

-s, --strict
    Enable strict checking.

DESCRIPTION

The idn command is a tool for converting domain names between internationalized domain name (IDN) representation and the standard ASCII representation. It's useful for displaying and manipulating domain names that contain non-ASCII characters (e.g., characters from languages other than English) in a way that is compatible with DNS and other internet protocols. This command allows you to encode a unicode domain name to its ASCII Punycode representation, or decode a Punycode representation to its unicode equivalent.

It relies on the libidn2 library. This library provides functions for encoding and decoding internationalized domain names according to the IDNA2008 standard. The idn command provides a convenient command-line interface to these functions, making it easy to process IDNs in shell scripts or from the command line. This utility is crucial for tools that work with domain names to ensure international domain names are handled correctly.

Common usages include converting unicode domain names to Punycode for registration or DNS configuration and converting Punycode domain names back to Unicode for display.

CAVEATS

The idn command's behavior depends on the underlying libidn2 library. Ensure the library is properly installed and configured. Different profiles (IDNA2003, IDNA2008) can result in different encodings. The idn command relies on locale settings for character encoding; ensure your locale is correctly configured for proper Unicode handling.

EXAMPLES

Convert a Unicode domain name to Punycode:
idn -a example.中文网

Convert a Punycode domain name to Unicode:
idn -d xn--example-wi6b.com

EXIT STATUS

The idn command returns 0 on success, and a non-zero value on failure. Failures can be due to invalid input, invalid options, or problems with the underlying libidn2 library.

HISTORY

The idn command and the libidn2 library were developed to address the need for handling internationalized domain names (IDNs). Before IDNs, domain names were restricted to ASCII characters, limiting the accessibility of the internet to non-English speakers. The development of IDNA (Internationalized Domain Names in Applications) standards and associated tools like idn enabled the use of Unicode characters in domain names, expanding internet accessibility globally. libidn2 is maintained to provide updated support for IDNA specifications and security enhancements.

SEE ALSO

iconv(1)

Copied to clipboard