idna: copy the idna package from x/text, take 2.

The version is not only API compatible, but is also meant
to mimic the original behavior of doing Punycode only
with only a minimum of additional checks.
Integrated from x/text/internal/export/idna at Git SHA1

All checks making things fundamentally stricter or checks
that require tables are now optional.

Fixes golang/go#18567
Fixes golang/go#18582

Change-Id: I08e6d7f7c276d1d84e02391e22f60c0a44a8ddad
Run-TryBot: Marcel van Lohuizen <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Brad Fitzpatrick <>
6 files changed