0

I am exporting data from magento which needs to be imported on another system. The magento installation is running on Unix, but the import is happening on windows.

So the csv is created on unix so the line breaks are just hex 0a, where as Windows expects them to be 0d 0a, I believe. If it's opened in wordpad then saved, then it's fine.

--- EDIT ---

This is what I'm doing to add lines to my csv:

fwrite($handle, '"'.implode('","', $productdata).'"'."\r\n");

Adding each field to the array and at the write I just implode the array on closing quotes and a comma and add \r\n onto the end.

From the limited amount I've read about it, it appears Unix/Mac parse CRLF as 0a while windows parses it as 0d 0a. Maybe I'm not quite hitting the nail on the head, regardless, the issue remains.

Is there any way I can force line breaks to be parsed as the hex that windows is looking for, or anyway I can manually add the hex?

Ryan
  • 729
  • 2
  • 13
  • 26
  • well `0a` (10) is just a line feed character (`\n`). You can do a global search and replace on the file with a program like Notepad++, or w/e you want. Replace all line-feeds with carriage-return line-feeds (CRLF aka `\r\n`) – crush Feb 26 '13 at 17:19
  • [Using PCRE](http://stackoverflow.com/questions/7836632/how-to-replace-different-newline-styles-in-php-the-smartest-way) to normalize new lines. – ficuscr Feb 26 '13 at 17:28
  • Edited my question with how I'm writing lines. I'm currently using `\r\n`, but being on unix it's created differently than windows expects. I don't need to replace, I can just change it, but what can I change it to to force both hex codes to be included? – Ryan Feb 26 '13 at 17:41

0 Answers0