Forums

Create ISO encoded CSV file

thoroe 06 Dec, 2019
Hi there,

first things first: I dont't know if my problem is Chronoforms related at all, or just Joomla related or maybe just a PHP thing I don't get. So please forgive me if I am totally wrong. But there are some clever minds in this forum and I hope someone can come up with a solution.

I have a simple Chronoforms form and need the data to get e-mailed as a CSV file attachment (one data row only). So I have set up a custom code which creates a CSV file with the data (via PHP's "fputcsv" function) and saves it in Joomla's tmp folder. The file is then attached to the e-mail, and after sending the e-mail, in another custom code I delete the tmp file. This all works nicely: When the form is sent, I receive the e-mail with the CSV file attached, all data inside.

However I need the CSV file to be ISO 8859-1 encoded, but whatever I try it always turns out to be UTF-8. I really like UTF-8, but unfortunately Excel doesn't.

I have tried to convert encoding of the strings before writing them with "fputcsv".
I have tried to open the tmp CSV file again, convert the content string (trying "mb_convert_encoding" as well as "iconv" seperately) and put it back into that same file.
I have done the same again, but with putting the converted string into a new file.

All I got was a UTF-8 encoded file.

Any ideas?

Thank you in advance.
This topic is locked and no more replies can be posted.