CSV node does not cope with quotes in property names. Bug or feature?

If I pass an array of objects to the CSV node and ask it to generate headers then, if any of the properties include a single quote character, then it fails with errors like
Error: Invalid property expression: unexpected array expression at position 12
Is that expected? I note that it does not fail with double quotes.

Example flow:

[{"id":"0a117283c6ec0e9a","type":"inject","z":"c57d82f577bb37d5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"a'a\":\"A1\",\"b\":\"B1\"},{\"a'a\":\"A2\",\"b\":\"B2\"}]","payloadType":"json","x":160,"y":460,"wires":[["e9b9c226cb22fc89"]]},{"id":"e9b9c226cb22fc89","type":"csv","z":"c57d82f577bb37d5","name":"","sep":",","hdrin":"","hdrout":"all","multi":"one","ret":"\\n","temp":"","skip":"0","strings":true,"include_empty_strings":"","include_null_values":"","x":330,"y":460,"wires":[["8a79b816b21ebf6f"]]},{"id":"8a79b816b21ebf6f","type":"debug","z":"c57d82f577bb37d5","name":"debug 28","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":500,"y":460,"wires":[]}]

[Edit] Node red 3.0.2, nodejs 16.17.1

Hard to review as an embedded flow. Could you please give a simplified example of the input CSV data? I'm fairly (but not entirely) sure I've processed a CSV with embedded single quote in the past.

But CSV's can be funny things depending on what app produced them.

The flow is just an inject node injecting

        "a'a": "A1",
        "b": "B1"
        "a'a": "A2",
        "b": "B2"

and a CSV node configured as

Ah, I misunderstood, I thought you were going the other way.

I also clearly didn't read the title properly either! I've dealt with input CSV's with quotes in the values but I've never come across any CSV's with quotes in the column names. That would be rare indeed since they probably wouldn't translate to other storage types such as SQL tables would they?

I can confirm that it appears to be an edge-case bug. I would raise as an issue on GitHub.

Thanks for checking it out. Issue submitted.