When dealing with excel's UTF8 encoding issue I had to add BOM to generated CSV file. When downloading file from a dev server, excel displays file without a problem, added BOM worked. But when downloading from production server, excel does not display UTF8 encoded file correctly. I've noticed in hex dump of the downloaded file from production server, that there are two extra hex chars "0a 0a ef bb bf" before BOM. File from dev server is ok. I've tried advice from php-readfile-adding-extra-bytes-to-downloaded-file without success. There is also option to download a pdf file, so I've checked it as well, the downloaded pdf file has the extra "0a 0a" chars too. I can confirm from phpinfo, that servers do not have the same php version. Production is php 5.6.32 and uses https connection, dev server is php 5.4.45. Due to this difference I think there is something that adds those "0a 0a", but I do not have a clue where to look, so I am asking you, what could be adding "0a 0a" to downloaded file?
Please let me know if you need any further information.