glidernet / ogn-ddb

OGN Devices DataBase
11 stars 15 forks source link

json download broken #38

Closed Meisterschueler closed 6 years ago

Meisterschueler commented 6 years ago

http://ddb.glidernet.org/download/?j=1 should return the ddb in json format. This does not work anymore. #

acasadoalonso commented 6 years ago

The std format it seems to work, I will take a look on the JSON format ...

AC/. Sent from my iPad

On 20 Apr 2018, at 21:16, Meisterschueler notifications@github.com wrote:

http://ddb.glidernet.org/download/?j=1 should return the ddb in json format. This does not work anymore. #

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

acasadoalonso commented 6 years ago

Folks,

It seems that is not accepting the ?j=1 url parameter when it is alone … the copy that I have on my home server is not having that problem … But with other parameter is OK. http://ddb.glidernet.org/download/index.php?cn=K5&j=1 http://ddb.glidernet.org/download/index.php?cn=K5&j=1 {"devices":[{"device_type":"I","device_id":"4407F9","aircraft_model":"LS-4","registration":"OE-5391","cn":"K5","tracked":"Y","identified":"Y"},{"device_type":"I","device_id":"4B4B3A","aircraft_model":"LS-4","registration":"HB-1683","cn":"K5","tracked":"Y","identified":"Y"},{"device_type":"F","device_id":"DD9124","aircraft_model":"Duo Discus","registration":"D-4010","cn":"K5","tracked":"Y","identified":"Y"},{"device_type":"F","device_id":"DD9570","aircraft_model":"SZD-50 Puchacz","registration":"OE-5424","cn":"K5","tracked":"Y","identified":"Y"},{"device_type":"F","device_id":"DDD9F1","aircraft_model":"ASW-27","registration":"OK-2727","cn":"K5","tracked":"Y","identified":"Y"},{"device_type":"F","device_id":"DDE48A","aircraft_model":"Janus Ce","registration":"D-2520","cn":"K5","tracked":"Y","identified":"Y"},{"device_type":"F","device_id":"DDEC8E","aircraft_model":"LS-4","registration":"HB-1683","cn":"K5","tracked":"Y","identified":"Y"},{"device_type":"F","device_id":"DF10F9","aircraft_model":"Duo Discus xlt","registration":"D-KWWH","cn":"K5","tracked":"Y","identified":"Y"}]} It seems to me that is a problem with the size of the output buffer, perhaps too many entries now. I will check the function: echo json_encode($output); We need to add: echo json_last_error_msg();
After calling Json_encode()… that way we will see what is the problem. perhaps we have some data with non UTF-8 data.

Cheers. AC/.

On 20 Apr 2018, at 21:16, Meisterschueler notifications@github.com wrote:

http://ddb.glidernet.org/download/?j=1 http://ddb.glidernet.org/download/?j=1 should return the ddb in json format. This does not work anymore. #

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/glidernet/ogn-ddb/issues/38, or mute the thread https://github.com/notifications/unsubscribe-auth/AHw8Z8b5uwkWyfhdMI3ppoPMS_Kugk1nks5tqjQYgaJpZM4Td9be.

snip commented 6 years ago

perhaps we have some data with non UTF-8 data.

You were right. Error message related to the json_encode is: Malformed UTF-8 characters, possibly incorrectly encoded

PR is welcome :) Thanks

acasadoalonso commented 6 years ago

I will submit the PR tonite However we need to find out the data that is incorrect on the database I will try to do an scan and find it out

Enviado desde mi iPhone. AC/.

El 22 abr 2018, a las 11:11, Sebastien Chaumontet notifications@github.com escribió:

perhaps we have some data with non UTF-8 data.

You were right. Error message related to the json_encode is: Malformed UTF-8 characters, possibly incorrectly encoded

PR is welcome :) Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Meisterschueler commented 6 years ago

The problem is here: 'F','DD8E53','L-60 Brigad�r','OM-LKL','LKL','Y','Y'

snip commented 6 years ago

I changed the value from L-60 Brigadýr to L-60 Brigadyr in the database. The json format is working again.

snip commented 6 years ago

Should we keep this open until we have a fix on code side or do you think we can close this issue?

Meisterschueler commented 6 years ago

Best would be if the ddb could handle utf-8 strings. But since the Brigadýr is a not so common aircraft I think removing the accent and keep out non-ascii chars is also a good solution.

clementallen commented 5 years ago

This seems to be an issue again :( @snip @Meisterschueler

snip commented 5 years ago

Fixed again. Was coming from Rhönbussard renamed as Rhonbussard. Thanks for the head-up.

clementallen commented 5 years ago

No problem @snip, although I'm certain this will come back again - is it worth looking at a more permanent fix?

snip commented 5 years ago

It is only coming when i add new aircraft type ... and forget that i should not add any special chars. Yes having a permanent solution is better, but i clearly not have time for that. If someone can propose a pull request he is welcome.