petlof / liveresults

EmmaClient is a client-server system for publishing liveresults from Orienteering events. It have been used on many major events such as JWOC, WOC, EOC,..
http://liveresultat.orientering.se
GNU Lesser General Public License v3.0
40 stars 24 forks source link

Invalid JSON in the API #47

Open juantrias opened 4 years ago

juantrias commented 4 years ago

http://liveresultat.orientering.se/api.php?method=getcompetitions is now serving an invalid JSON because of a tab character inside " BEL_Ve Sprint Rocourt" competition. Tab characters and other special characters should be escaped on JSON when used inside strings https://www.freeformatter.com/json-escape.html.

I suppose that using json_encode to build the JSON as suggested in #43 should solve the problem. Otherwise you would have to manually escape this special chars before building the JSON.

live-results-getcompetitions-invalid-json
eVe9n commented 3 years ago

I have the same issue with another competition.

petlof commented 3 years ago

Thanks for reporting this. The whole API is under reconstruction where there will be a lot more and better validation on these issues.

What is the eventid you have issues with?

Den fre 1 okt. 2021 kl 13:52 skrev eVe9n @.***>:

I have the same issue with another competition.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/petlof/liveresults/issues/47#issuecomment-932161239, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOXVUU7BS2X4D74IKRXZ53UEWOHRANCNFSM4PKOAOTA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

eVe9n commented 2 years ago

Sorry I didn't save the eventid I remember the name started with MTBO. Right now it doesn't return any error.

eVe9n commented 2 years ago

I have the same issue with another competition: "id":22247, "name":" Mistrovství ČR ve sprintu"

Also, It's difficult to me if the JSON return a extra double quotes. For example in this competition: 2022-05-07 ДП 20-21 Средна дистанция / купа "Христо Ботев" БФО, Вариант5 Competition: "id":22509, "name":"ДП 20-21 Средна дистанция / купа ""Христо Ботев"""

jsh-de commented 9 months ago

Just found out the API to retrieve the events was delivering invalid JSON due to some events having TAB-characters (ASCII 9) in their name: 20411;DM, sprint, Västergötland[TAB];2021-09-11 00:00:00 21615;Barbate SUN-O Cup - Night+Classic[TAB];2022-02-12 00:00:00 28408;2[TAB]Купа knsb;2022-12-02 00:00:00

I cleaned up those events manually and so the JSON seems to be clean... for now. :)