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.


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 '¢¾¼script¾alert(¢XSS¢)¼/script¾' 2>&1
libidn 0.5.13
Copyright 2002, 2003, 2004, 2005 Simon Josefsson.
GNU Libidn comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Libidn under the terms of
the GNU Lesser General Public License.  For more information
about these matters, see the file named COPYING.LIB.
idn: Could not convert from 'UTF-8' to UTF-8.
$ 

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;