0

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.

  • 2
    `0a` is a newine character; you probably have a couple of lines in your script outside of the ` – Mark Baker Jan 20 '18 at 18:56
  • Hi Mark, thanks. I know 0a is a line feed char. My cakephp app code is the same on dev and prod servers. As I mentioned, I've checked for this problem, like it was suggested in the linked so question. Then it could really only be in builded php on the server, to which I do not have access, only to my app folder. – ViktorFowl67 Jan 20 '18 at 19:23
  • I've found out that hosting provider moved to new severs few months ago and noticed some folders had weird access rights. I completely removed all files and re-uploaded from git. And now no `0a`'s . I can only guess if something got corrupted during the move. – ViktorFowl67 Jan 20 '18 at 22:52

0 Answers0