I have a PHP script that fetches an ICS file, makes some changes to it, and rewrites it for download using `Content-Type: application/ics` and `Content-Disposition: attachment; filename="test.ics"`. The script works fine. However, some characters like `'` get converted to `&#039;`, but not all of them, only those in lines that I have modified.

When I `var_dump` the string that is being written as payload, the browser displays all characters fine.

Any idea ?

EDIT: I use an ICS parser from [here](https://github.com/johngrogg/ics-parser). The problem comes from it but after looking through the code I can't find where it could replace some characters by `htmlentities`.