This error is related to caching and compression. Wish I had time to dig deeper now, but I don't.
For us, it happened when a database was moved to a new server without turning off anonymous page caching first.
1. Adding the following line to settings.php:
$conf['page_compression'] = FALSE
2. Logging into the site using Firefox (not Safari) and going to http://www.example.com/admin/config/development/performance and hitting the Clear All Caches button.