How to export data in CSV DOS/Windows format

Solved
sipherion Posted messages 1836 Registration date   Status Member Last intervention   -  
ryko1820 Posted messages 1633 Registration date   Status Member Last intervention   -
Hello to all PHP enthusiasts,

I have an app where I need to import a CSV in Dos\Windows format, but when I export from an app I developed, I get it in Macintosh format, so the import doesn't work correctly.

My headers:

header('Content-Encoding: UTF-8'); header('Content-type: text/csv; charset=UTF-8'); header('Content-Disposition: attachment; filename="agents_list.csv"');


Notepad++ tells me that my export is Macintosh, and when I export from the other tool, it is indeed in Dos\Windows format.

How can I do a Dos\Windows export in CSV?

Thank you for your help

"It's better to know everything to look for than to try to know everything."

3 answers

ryko1820 Posted messages 1633 Registration date   Status Member Last intervention   310
 
Hello,

maybe a BOM story (UTF-8 with or without :: Notepad++ can see it, I believe) or perhaps switch to WINDOWS-1252 encoding.

You may stop me but you can't stop us all ;-)
0
sipherion Posted messages 1836 Registration date   Status Member Last intervention   287
 
Yes, I can modify it in Notepad++, but that’s not my question. Here, I’m looking to export directly in the right format to automate the export/import process.

--
"It is better to know everything to search for than to try to know everything."
0
ryko1820 Posted messages 1633 Registration date   Status Member Last intervention   310
 
Notepad++ was mainly "a thing" to see if the file had a BOM or not because in Windows I don't know how to check it otherwise....
0
sipherion Posted messages 1836 Registration date   Status Member Last intervention   287
 
I found, in my PHP script that was generating the document, I had just used \r for line breaks; by using \r\n it understands that it’s in Windows format.
Thanks anyway.

--
"It is better to know how to search for everything than to seek to know everything."
0
ryko1820 Posted messages 1633 Registration date   Status Member Last intervention   310
 
I will try to remember it, in case I ever have to generate files for this operating system ;-)
0