Incorrect encoding to punycode

Summary

Incorrect/invalid output when trying to encode the domain: ☺.unicode.

It appears the punycode encoder generates a domain label that includes a space. Several punycode generators do this, including dnspython and Python's IDNA encoding built-in.

This came up while performing testing ahead of migrating towards a new system of handling DNS records which uses Python, however, we've subsequently identified that it affects dig as well (and thus libidn2).

They (ISC) have asked me to log this here. (Downstream issue at https://gitlab.isc.org/isc-projects/bind9/issues/1610)

Version used

idn2 (libidn2) 2.2.0

Steps to reproduce

$ idn2 ☺.unicode

What is the current bug behavior?

The idn2 command returns

xn-- o-oia59s.unicode

What is the expected correct behavior?

I'd expect idn2 to return the correctly encoded domain. I'm not sure what the correctly encoded domain is, although my suspicion is that it should be xn--xba3f15e.unicode.

Edited by Chris Malton