excel - Sanitizing data in PHP for excell xml -
i using "excel xml" php library (marin crnković, version 0.9) write data database .xls file. problem database contains data not legal, , causes microsoft excel give me errors when opening file. (the document cannot opened because there problems contents)
samples of bad data causing excel display errors instead of opening file:
!(()&&!|||
'"()&%1prompt(918861)
'&cat /etc/passwd&'
'&dir&'
"&cat /etc/passwd&"
email&n921923=v950402
is there recommended function sanitize data before inserting data excel file?
it might need escape/encode ampersands before using them excel spreadsheets (as new formats xml-based). php, perhaps try like:
$value = str_replace('&', '&', $value);