Change encoding to latin-1 for JSON output. This should all be rewritten to be UTF-8 from database through to web eventually.

Main code rev. 1952