note 109036 deleted from function.iconv by danbrown
| From: | danbrown@php.net | Date: | Fri, 15 Jun 2012 16:00:43 +0000 |
| Subject: | note 109036 deleted from function.iconv by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188637@lists.php.net to get a copy of this message | ||
Note Submitter: orrd101 at gmail dot com
----
I mentioned in an earlier post that "//IGNORE" option doesn't work with recent
versions of the iconv library because the PHP code still hasn't been updated to work with the
new version.
Here's a workaround (thanks to other who have mentioned mb_convert_encoding)...
ini_set('mbstring.substitute_character', "none");
$text= mb_convert_encoding($text, 'UTF-8', 'UTF-8');
That will strip invalid characters from UTF-8 strings (so that you can insert it into a database,
etc.). Instead of "none" you can also use the value 32 if you want it to insert spaces in
place of the invalid characters.