Improve parsing of commas within text strings
Our friend Shawn, on support ticket #15079 was having a bit of awkwardness trying to define some string-valued options in which the strings contained commas.
He wrote:
We have a customer attempting to put a comma separated string into an option defined as text in Kea. Kea appears to be treating the comma as a delimiter for arrays and discarding the comma and the text after the comma. It appears that you may have addressed this issue somewhat in 1.6.0 but I wanted to check if there is any way to escape or otherwise allow for commas in text strings in 1.5.0.
For example given this option definition
{
"space": "dhcp4",
"code": 176,
"type": "string",
"name": "test"
}
And this specification for the option value
{
"name": "test",
"code": 177,
"data": "foo,bar"
}
We are only seeing "foo" put into the packet sent to the client. I have tried single quoting the text "'foo,bar'" and escaping the comma "foo,bar" and neither seem to work.
In a subsequent response on the same ticket he mentions that he has found a way to successfully escape the commas using multiple backslashes but this is likely to be a situation encountered by other operators who may find it similarly confusing, therefore we should consider (ideally) improving the parsing of commas that are within string literals OR (if not) at least better documenting how to use them.