how to use IDN for supported rdata?

17 views
Skip to first unread message

Jeremy C. Reed

unread,
Sep 21, 2021, 10:17:27 PM9/21/21
to dnspyth...@googlegroups.com
I see some IDN code.

For example to get the punycode name to IDN I use
rrset.name.to_unicode()

Without IDN, to get rdata text I am using to_text.
For example to print a NS rdata (for example
ns1.xn--12c4cbf7aots1ayx.com.) I cannot use to_unicode.

AttributeError: 'NS' object has no attribute 'to_unicode'

Is there a way to tell to_text for rdata to convert names only (and not
other text) to IDN?

If not, my workaround is to check for rrtypes with rrnames and get
those to text and then convert just that part.

For example to convert the MNAME and RNAME SOA fields in the
following to IDN:

xn--12c4cbf7aots1ayx.com. 976 IN SOA
ns1.xn--12c4cbf7aots1ayx.com. hostmaster.xn--12c4cbf7aots1ayx.com.
2020020800 14400 3600 1209600 86400

(I don't want to write my own routines for every rrtype with names in
the rdata.)

Is there a way to do this in dnsypython currently? (And if so, how I can
find documentation for this? I have searched and looked through code.)


I was thinking something like to_text(idna_codec=dns.name.IDNA_2003) but
I think that was idea before to_unicode() ?

Thank you

Bob Halley

unread,
Sep 28, 2021, 9:02:37 PM9/28/21
to dnspython-users
There isn't an IDN standard for DNS text format in general.   IDN conversions are really about how layers above the DNS display international domain names to users.  So basically you have to do the conversions yourself between the UI/presentation layer and the DNS.  Even if there were an IDN zone file standard, changing dnspython to support it would be a huge job.  (I tried doing such a format once and it ended badly!)
Reply all
Reply to author
Forward
0 new messages