Skip to content

Commit

Permalink
CSVImporter - normalize ALL new lines characters ushahidi#1140
Browse files Browse the repository at this point in the history
Really fix the new line issues in the CSV Importer this time, replace any
unicode new line character with \n.
  • Loading branch information
rjmackay committed Nov 18, 2013
1 parent cd419d3 commit a5027e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions application/libraries/CSVImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ function import($file)
// Get contents of CSV file
$data = file_get_contents($file);

// Replace carriage return character
$replacedata = preg_replace("/\r\n/","\n",$data);
// Normalize new lines, replace ANY unicode new line with \n (should cover Mac OS9, Unix, Windows, etc)
$replacedata = preg_replace("/\R/u","\n",$data);

// Replace file content
file_put_contents($file, $replacedata);
Expand Down

0 comments on commit a5027e6

Please sign in to comment.