mafintosh / dns-packet

An abstract-encoding compliant module for encoding / decoding DNS packets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Decode TXT responses as text

silverwind opened this issue · comments

These are currently encoded as a Buffer, but I think it would be more useful to have them as a text string. If we decode them as text, should ASCII or UTF8 be used? I'd wager the spec only supports ASCII but I see no harm if we do UTF8 as it is a superset of ASCII.

@mafintosh any opinion?

@silverwind we should keep them as buffers. We used to have them as strings but I remember @watson found it there is some case where they can contain binary data in the spec

You're right. While the original RFC that specs TXT limits it to ASCII, rfc6763 introduces possibly binary data.

The value is opaque binary data. Often the value for a particular
attribute will be US-ASCII [RFC20] or UTF-8 [RFC3629] text, but it is
legal for a value to be any binary data.