internal/export/idna: fix verifyDNSLength option

The previous code hardwired the NonTransitional profile for
certain operations. This had the effect of erasing the
verifyDNSLength flag meaning labels were almost never checked
for proper length. Fixing this exposed various issues.

Also fixes panic for empty strings.

Updates golang/go#18567.

Change-Id: I54763d913fbd63a50d5f7a93d3cf36ef6270abfd
Reviewed-on: https://go-review.googlesource.com/36280
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2 files changed