note 109036 added to function.iconv
| From: | orrd101 at gmail dot com | Date: | Thu, 14 Jun 2012 20:08:42 +0000 |
| Subject: | note 109036 added to function.iconv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188616@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 99.88.245.232
----
Manual Page -- http://www.php.net/manual/en/function.iconv.php
Edit -- https://master.php.net/note/edit/109036
Del: integrated -- https://master.php.net/note/delete/109036/integrated
Del: useless -- https://master.php.net/note/delete/109036/useless
Del: bad code -- https://master.php.net/note/delete/109036/bad+code
Del: spam -- https://master.php.net/note/delete/109036/spam
Del: non-english -- https://master.php.net/note/delete/109036/non-english
Del: in docs -- https://master.php.net/note/delete/109036/in+docs
Del: other reasons-- https://master.php.net/note/delete/109036
Reject -- https://master.php.net/note/reject/109036
Search -- https://master.php.net/manage/user-notes.php