Not sure if my comment here is valuable, but I had a similar problem that I want to share with you, who knows, maybe this can help some of you.
In my project, I activated GZIP in the CI configuration file:
$config['compress_output'] = TRUE;
Itβs well said in the configuration file that:
| Enables Gzip output compression for faster page loads. When enabled, | the output class will test whether your server supports Gzip. | Even if it does, however, not all browsers support compression | so enable only if you are reasonably sure your visitors can handle it. | | VERY IMPORTANT: If you are getting a blank page when compression is enabled it | means you are prematurely outputting something to your browser. It could | even be a line of whitespace at the end of one of your scripts. For | compression to work, nothing can be sent before the output buffer is called | by the output class. Do not 'echo' any values with compression enabled. | */
"Do not echo any values ββwith compression enabled." it is very important here.
However, my function must echo the json code for my Ajax call.
To fix this, I added the "exit" function after my "echo" to the function.
echo json_encode($arr_ajaxResults); exit();
Now, with this input, I no longer encounter a Content Encoding error.
I hope this helps guys who have the same problem.
josemaria
source share