Hi,

I'm doing some work using the TWFY API and I think that some problems I'm getting might be down to it returning incorrect headers (and data).

For example:

$ curl --head "http://www.theyworkforyou.com/api/getConstituency?name=Ynys+Mon&output=js&key=$TWFY_KEY";
HTTP/1.1 200 OK
Content-Type: text/javascript; charset=iso-8859-1
x-url: /api/getConstituency?name=Ynys+Mon&output=js&key=CpkcgmCFQJpAAGnb3oE6XHuy
Content-Length: 201
Date: Mon, 20 May 2013 12:50:42 GMT
Age: 0

It's the Content-Type header that bothers me. I think that's wrong for two reasons. Firstly, it should be 'application/json' and secondly (and more importantly) I thought that JSON should be encoded in UTF-8 by definition.

As it happens, the charset value is correct. The data I'm getting back *is* ISO-8859-1. But that's a problem for some of the JSON tools that I'm using which are (understandably) confused by JSON that isn't in UTF-8.

I understand that the differences between ISO-8859-1 and UTF-8 are tiny across all of the data that TWFY holds. The example above is about the only one I can think of. But it's an important one to my application.

I anyone wanted to point me at the relevant part of your github repo then I'd be happy to attempt a patch. And if I'm bringing this up in completely the wrong place, then please point in the right direction.

Cheers,

Dave...


_______________________________________________
developers-public mailing list
[email protected]
https://secure.mysociety.org/admin/lists/mailman/listinfo/developers-public

Unsubscribe: 
https://secure.mysociety.org/admin/lists/mailman/options/developers-public/archive%40mail-archive.com

Reply via email to