semi-colon ";" in rdata for TXT records
barmar at alum.mit.edu
Tue Oct 2 02:02:47 UTC 2007
In article <fdqki7$le6$1 at sf1.isc.org>,
"Jack Tavares" <j.tavares at F5.com> wrote:
> Hello all -
> I am having a small problem.
> Given these 2 TXT records in a zone file
> isescaped TXT "escaped semi-colon\;"
> unescaped TXT "unescaped semi-colon;"
> (one has an escaped semi-colon, one has an UNescaped semi-colon)
> dig returns
> isescaped.test.net. 500 IN TXT "escaped semi-colon\;"
> unescaped.test.net. 500 IN TXT "unescaped semi-colon\;"
> dig makes sure that the semi-colon is escaped for output purposes.
> Now I have another tool, written in C/C++ that calls ns_sprintrr (from
> This does include the "\" before the semi-colon on EITHER TXT record
That's because both TXT records are essentially the same in that regard.
The last two characters of both are "n" and semicolon.
Semicolons don't require escaping when they're in quoted strings, but
it's OK to escape them anyway. A backslash simply causes the following
character to be treated as a constituent of the string. If that's its
normal meaning, the backslash is ignored. I think the only characters
that REQUIRE escaping in strings are double-quote (to prevent it from
terminating the string) and backslash itself (to prevent it from being
an escape). Maybe newline as well, but I'm not sure.
> I have 2 questions:
> 1. is the "\" (slash) included in the wire format or is it stripped out?
It isn't. The wire syntax is a counted string. There's no parsing
done, so no need for any escaping.
> 2. what routine is dig using to print the record?
Can't you read the source?
Did you mean to say 'This does NOT include the "\"' above?
Barry Margolin, barmar at alum.mit.edu
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
More information about the bind-users