1) If you read a .csv file for download:
use \xEF\xBB\xBF after headers and just before you echo file data. For example:
echo "\xEF\xBB\xBF"; // UTF-8 BOM
2) If you echo per line use htmlspecialchars_decode to covert single and double quotes. For example:
echo '"'.htmlspecialchars_decode($val, ENT_QUOTES).'"'.',';
Hello Friends, I’m Arvind Kumar, founder of Inimist Technologies, Inimist Academy, The Fundabook and many more. I am a Full Stack Web Developer and Programmer by heart, and a Hindi/English blogger by chance. I build Web and Mobile Application around React, VueJS, NodeJS and PHP frameworks.
Have a project in mind? Get in touch