From: Saurabh Batra Date: Tue, 12 Apr 2016 05:20:53 +0000 (+0530) Subject: CRM-17859 - import contacts from CSV: sanitise / cleanup non-breaking… (#7813) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5dcdc4d639cc0982c92431648e50d79251baa0ca;p=civicrm-core.git CRM-17859 - import contacts from CSV: sanitise / cleanup non-breaking… (#7813) * CRM-17859 - import contacts from CSV: sanitise / cleanup non-breaking spaces from records https://issues.civicrm.org/jira/browse/CRM-17859 * Update String.php --- diff --git a/CRM/Import/DataSource/CSV.php b/CRM/Import/DataSource/CSV.php index 6d7d6dd033..89c7f22cc0 100644 --- a/CRM/Import/DataSource/CSV.php +++ b/CRM/Import/DataSource/CSV.php @@ -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++;