DVBProject / DVB-I-Reference-CSR

Project to create a DVB-I Central Service Registry for DVB-I client service (list) discovery
MIT License
8 stars 3 forks source link

CSR Endpoint returns 400 code when using Language parameter with 3 characters #13

Closed removogel closed 2 years ago

removogel commented 2 years ago

issue originally from @MThomas98

When querying against https://csr.dtv.fi/api/query using the 3 letter language code format (e.g. "deu") a 400 response is given, whilst queries using the 2 letter format (e.g. "de") work as expected.

From A177 Section 5.2.10:

A DVB-I Service List or Service List Entry Points List allows certain elements to be repeated to convey the same information in different natural languages. Such elements use the mpeg7:TextualType datatype which allows the optional inclusion of an xml:lang attribute, the value of which shall be a language code as defined by IETF BCP 47 RFC 5646 [30]. Each such element shall only be repeated once per language code. If the xml:lang attribute is not provided for an element, then the language of the element shall be that of the closest ancestor element.

And RFC 5646 defines language as language = 2*3ALPHA, so 3 letter codes should be accepted.

The following returns a 400 error: https://csr.dtv.fi/api/query?TargetCountry=DEU&Delivery%5B%5D=dvb-dash&Delivery%5B%5D=dvb-t&Language=deu whilst the following works as expected: https://csr.dtv.fi/api/query?TargetCountry=DEU&Delivery%5B%5D=dvb-dash&Delivery%5B%5D=dvb-t&Language=de

paulhiggs commented 2 years ago

Take a look at the IANA Language Registry that is referenced by clause 2.1.1 of RFC5646.

While DEU is a valid ISO-3166 country code, the IANA language code for German is de.

MThomas98 commented 2 years ago

Hi @paulhiggs,

Ah, I see now, thanks for clearing that up for me.