Try GNU Libidn

This page allows you to try the string preparation, punycode encode/decode and ToASCII/ToUnicode operations of GNU Libidn. If you encounter a problem with this page, write a (detailed!) report to bug-libidn@gnu.org.

If you are interested in commercial support or enhancement of Libidn, you can contact me.

Free shrimp sandwiches are served over here (or here if you want the experimental flavour).

This page ignores any Accept-Charset headers sent by your browser. Instead, the Unicode repertoire encoded as UTF-8 is used. If you are using software that cannot handle this, you must select another MIME charset below. BIG5, ISO-2022-JP-2, ISO-8859-1, and KOI-8 are popular choices. I am sorry for the inconvenience.


Input

The following string must only contain characters that your browser is able to represent in UTF-8 when submitting this form. If you wish to use another charset you must select it below, submit the form and wait for a new page to load, and then enter your string.

Prepare string using profile:
Punycode encode
Punycode decode
IDNA ToASCII
IDNA ToUnicode
Allow Unassigned
UseSTD3ASCIIRules
Debug
Change MIME charset of page to:


Output

$ CHARSET='UTF-8' idn --idna-to-ascii 'räksmörgås.josefßon.org' 2>&1
xn--rksmrgs-5wao1o.josefsson.org
$ 

Examples


Error codes


  enum
  {
    PUNYCODE_SUCCESS = 0,
    PUNYCODE_BAD_INPUT,		/* Input is invalid.                       */
    PUNYCODE_BIG_OUTPUT,	/* Output would exceed the space provided. */
    PUNYCODE_OVERFLOW		/* Input needs wider integers to process.  */
  };


  typedef enum
  {
    STRINGPREP_OK = 0,
    /* Stringprep errors. */
    STRINGPREP_CONTAINS_UNASSIGNED = 1,
    STRINGPREP_CONTAINS_PROHIBITED = 2,
    STRINGPREP_BIDI_BOTH_L_AND_RAL = 3,
    STRINGPREP_BIDI_LEADTRAIL_NOT_RAL = 4,
    STRINGPREP_BIDI_CONTAINS_PROHIBITED = 5,
    /* Error in calling application. */
    STRINGPREP_TOO_SMALL_BUFFER = 100,
    STRINGPREP_PROFILE_ERROR = 101,
    STRINGPREP_FLAG_ERROR = 102,
    STRINGPREP_UNKNOWN_PROFILE = 103,
    /* Internal errors. */
    STRINGPREP_NFKC_FAILED = 200,
    STRINGPREP_MALLOC_ERROR = 201
  } Stringprep_rc;

  typedef enum
  {
    IDNA_SUCCESS = 0,
    IDNA_STRINGPREP_ERROR = 1,
    IDNA_PUNYCODE_ERROR = 2,
    IDNA_CONTAINS_NON_LDH = 3,
    /* Workaround typo in earlier versions. */
    IDNA_CONTAINS_LDH = IDNA_CONTAINS_NON_LDH,
    IDNA_CONTAINS_MINUS = 4,
    IDNA_INVALID_LENGTH = 5,
    IDNA_NO_ACE_PREFIX = 6,
    IDNA_ROUNDTRIP_VERIFY_ERROR = 7,
    IDNA_CONTAINS_ACE_PREFIX = 8,
    IDNA_ICONV_ERROR = 9,
    /* Internal errors. */
    IDNA_MALLOC_ERROR = 201
  } Idna_rc;