Page 1 of 1

inconsistent output when using % signs

Posted: Mon Jun 09, 2014 3:46 pm
by jssingh
Hi,

I have some output that is killing the JSON when it has % signs, which seemed odd to me that percent signs alone would kill the JSON, so I decided to test it out and the output I'm getting is wildly inconsistent (but interesting). In the examples below, I see the output correctly in the HTML page (cgi-bin/extinfo.cgi). The first one is the example of when it works correctly.

Input:
Group Share% Use

JSON Output:
"Group Share% Use"

Input:
Group Share% Use% Share

JSON Output:
"Group Share% Use�����hare"

Input:
Group Share% Use% hare

JSON Output:
"Group Share% Use 0x0.000300000003p-1022re"

Input:
Group 90%

JSON Output:
""

Input:
Testing % sign

JSON Output:
"Testing `֞ign"


Any ideas? I'm using commit 6081644, but I had this problems with % signs when I was using 4.0.4 and 4.0.7 (the release from last week).

Re: inconsistent output when using % signs

Posted: Tue Jun 10, 2014 3:26 pm
by abrist
I opened an issue on github: https://github.com/NagiosEnterprises/na ... e/issues/4
There is a chance that the % signs are not escaped correctly in the cgis. Eric[0] or Eric[1] should respond here or on github rather soon.

Re: inconsistent output when using % signs

Posted: Sun Jun 15, 2014 2:56 pm
by estanley
Thanks again for reporting issues with the JSON CGI. Andy is correct that the percent signs were not being escaped. Commit 04c80dd appears to resolve this issue. I've tested each of the cases you listed and they now display correctly. Please test the commit and let us know whether it works for you.

Re: inconsistent output when using % signs

Posted: Mon Jun 16, 2014 11:50 am
by jssingh
I tested it with the live data and everything shows up perfectly. Thank you!

a side note: a coworker suggested that I try the HTML code for percent signs:

Code: Select all

%
and that broke things even worse!, but this commit fixes that issue as well.

Re: inconsistent output when using % signs

Posted: Mon Jun 16, 2014 12:14 pm
by tmcdonald
Thanks for the feedback! Closing up.