New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-17859 - import contacts from CSV: sanitise / cleanup non-breaking… #7813
Conversation
ffb96e7
to
3d99f8b
Compare
*/ | ||
function trim_nbsp($string) { | ||
return trim($string, chr(0xC2) . chr(0xA0)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of placing this function in the global scope, I would suggest putting it in this class (or CRM_Utils_String). Or maybe easiest & simplest for now would be to make it an anonymous function and pass it straight into array_map.
3d99f8b
to
9d15d2b
Compare
@colemanw I shifted the function to the CRM_Utils_String class. |
9d15d2b
to
9bfeeed
Compare
Ok now that it's a general utility function, I'm wondering... does this function do anything other than remove |
The "usual" whitespace characters are handled well by the standard trim function. I think if any other peculiar whitespace characters were to be reported later on, those could easily be added to this function. |
FYI Civicrm requires php 5.3+ |
Well. Did not know that. In that case I'll shift it to an anonymous function. Neat! |
9bfeeed
to
7571965
Compare
I believe the test failures are unrelated. |
Jenkin, test this please |
#test #import I was able to replicate this by creating some html with   at the end of the email address & copying to an open office spreadsheet & saving as csv. the resulting csv would not import |
I can confirm that after applying this patch I was able to complete the import |
I had some success replicating this in a unit test - see https://github.com/civicrm/civicrm-core/pull/8113/files |
… spaces from records
https://issues.civicrm.org/jira/browse/CRM-17859