lloyd / yajl

A fast streaming JSON parsing library in C.
http://lloyd.github.com/yajl
ISC License
2.15k stars 435 forks source link

new line by the end of error messages #227

Open zimmerle opened 4 years ago

zimmerle commented 4 years ago

Is it correct to expect that all error messages will end with a new line?

In my use case scenario, the new line could be very annoying as reported here: https://github.com/SpiderLabs/ModSecurity/issues/2278#L107

I understand that chomp is an option. However, I don't want to remove something that is eventually valid.

robohack commented 4 years ago

The trailing newline has always appeared on all error messages returned by yajl_get_error(), or at least has since 2007. If you set the verbose flag you even get multiple lines.

jeremyjpj0916 commented 4 years ago

Should such a trailing newline be removed or are there concerns there? Or should clients of this library parse around it and handle the format themselves?

robohack commented 4 years ago

As I said, the newlines are there on purpose as multiline messages are possible and necessary.