importing CSV from Macs on Linux/PHP

I came across an interesting one the other day. A client was bulk uploading and always having issues – the system was reporting that the file wasn’t a csv had bad structure and so on.  I initially thought the client was being a dufus… however  MACs as it turns out do not do csv end of lines as \r or \n
…so in php:

exec(“tr ‘\15’ ‘\n’ <“.$UsersMacFile. ” >” .$SystemsCSVFile );

will convert it. Wowser…

 

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s