IDN(2)                                                     IDN(2)

     NAME
          utf2idn, idn2utf - convert internationalized domain names to
          and from unicode

     SYNOPSIS
          #include <u.h>
          #include <libc.h>

          int  utf2idn(char *name, char *buf, int nbuf);

          int  idn2utf(char *name, char *buf, int nbuf);

     DESCRIPTION
          These routines handle encoding and decoding of domain names
          as specified by RFC5890.

          Utf2idn encodes the UTF string name to ASCII internatlional-
          ized domain name in buf. Idn2utf does the reverse, decoding
          the ASCII string name back to UTF in buf. The maximum size
          of buf is gived by nbuf.

     SOURCE
          /sys/src/libc/9sys/idn.c

     SEE ALSO
          /lib/rfc/rfc5890
          utf(6)

     DIAGNOSTICS
          The return value is the number of bytes (excluding the ter-
          minating NULL) in buf or -1 on failure.