I was building a file download Class for my CMS in PHP, at a time I noticed it outputs files in a different Encoding format. I tried with readfile, file_get_contents,fread but a
The problem lies in the Content-Disposition
header. This header is not really part of the HTTP protocol, see RFC 2616, 15.5 Content-Disposition Issues
Content-Disposition is not part of the HTTP standard, but since it is widely implemented, we are documenting its use and risks for implementors.
And later in section 19.5.1 Content-Disposition
The Content-Disposition response-header field has been proposed as a means for the origin server to suggest a default filename if the user requests that the content is saved to a file.
...
An example is
Content-Disposition: attachment; filename="fname.ext"
If this header is used in a response with the application/octet- stream content-type, the implied suggestion is that the user agent should not display the response, but directly enter a `save response as...' dialog.
Leaving out this header shows the contents of the sent file.
I have tested this with Firefox only, so other web browsers might behave different.