I had a similar problem, as well as downloading emails from CSV and problems with "undetectable" spaces.
Allowed it, replacing the most common urlencoded whitespace characters with ''. This can help if you cannot use mb_detect_encoding () and / or iconv ()
$urlEncodedWhiteSpaceChars = '%81,%7F,%C5%8D,%8D,%8F,%C2%90,%C2,%90,%9D,%C2%A0,%A0,%C2%AD,%AD,%08,%09,%0A,%0D'; $temp = explode(',', $urlEncodedWhiteSpaceChars); // turn them into a temp array so we can loop accross $email_address = urlencode($row['EMAIL_ADDRESS']); foreach($temp as $v){ $email_address = str_replace($v, '', $email_address); // replace the current char with nuffink } $email_address = urldecode($email_address); // undo the url_encode
Note that this does NOT discard the βnormalβ space character and that it removes these space characters from anywhere in the line β not just the beginning or end.
Rid ikulous
source share