CRM-17859 - import contacts from CSV: sanitise / cleanup non-breaking… (#7813)
authorSaurabh Batra <saurabh.batra96@gmail.com>
Tue, 12 Apr 2016 05:20:53 +0000 (10:50 +0530)
committerEileen McNaughton <eileen@mcnaughty.com>
Tue, 12 Apr 2016 05:20:53 +0000 (17:20 +1200)
* CRM-17859 - import contacts from CSV: sanitise / cleanup non-breaking spaces from records

https://issues.civicrm.org/jira/browse/CRM-17859

* Update String.php

CRM/Import/DataSource/CSV.php

index 6d7d6dd0335944bad75ff1e9773809fa8a9b5b1e..89c7f22cc009d75231e3c91dc87c56573c711f53 100644 (file)
@@ -229,6 +229,12 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
       }
 
       $first = FALSE;
+
+      // CRM-17859 Trim non-breaking spaces from columns.
+      $row = array_map(
+        function($string) {
+          return trim($string, chr(0xC2) . chr(0xA0));
+        }, $row);
       $row = array_map('civicrm_mysql_real_escape_string', $row);
       $sql .= "('" . implode("', '", $row) . "')";
       $count++;