diff --git a/models/record.go b/models/record.go index 4635d6eb8e..ff60bc9917 100644 --- a/models/record.go +++ b/models/record.go @@ -344,7 +344,7 @@ func (rc *RecordConfig) ToComparableNoTTL() string { // SoaSerial is not included because it isn't used in comparisons. case "TXT": // fmt.Fprintf(os.Stdout, "DEBUG: ToComNoTTL raw txts=%s q=%q\n", rc.target, rc.target) - r := txtutil.EncodeQuoted(rc.target) + r := txtutil.EncodeSingle(rc.target) // fmt.Fprintf(os.Stdout, "DEBUG: ToComNoTTL cmp txts=%s q=%q\n", r, r) return r case "LUA": diff --git a/pkg/txtutil/txtcode.go b/pkg/txtutil/txtcode.go index b5b1afb3b6..b412b6b4c5 100644 --- a/pkg/txtutil/txtcode.go +++ b/pkg/txtutil/txtcode.go @@ -36,6 +36,13 @@ func EncodeQuoted(t string) string { return txtEncode(ToChunks(t)) } +// EncodeSingle encodes a string as a single quoted value without splitting +// into 255-octet chunks. This is intended for user-facing display (e.g., diff +// preview) where the chunked representation is confusing. +func EncodeSingle(t string) string { + return txtEncode([]string{t}) +} + // State denotes the parser state. type State int