note 109796 added to function.iconv
| From: | nate | Date: | Tue, 21 Aug 2012 17:59:57 +0000 |
| Subject: | note 109796 added to function.iconv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190160@lists.php.net to get a copy of this message | ||
To comment on php's iconv() //IGNORE option not working, that's not quite true. The
//IGNORE option is not designed to handle invalid byte sequences in the input string. Rather, while
operating on a string that is valid in the "from" charset, the //IGNORE option will simply
discard characters that cannot be represented by an approximate sequence in the "to"
charset.
The //IGNORE option does not let you get away with passing garbage in the input - the string you
pass must be valid when looked at through the "to" charset. iconv itself does have a
separate "-c" option on the command-line which enables an option to skip/remove invalid
byte sequences in the input string. This is entirely separate from the purpose of the //IGNORE
option. So php does not have a bug, it simply does not provide a method for using the "-c"
option of iconv, which is unfortunate.
A work-around, as mentioned by another commenter, is to make the system call to the iconv program
with the "-c" option.
----
Server IP: 216.235.13.26
Probable Submitter: 66.152.79.250
----
Manual Page -- http://www.php.net/manual/en/function.iconv.php
Edit -- https://master.php.net/note/edit/109796
Del: integrated -- https://master.php.net/note/delete/109796/integrated
Del: useless -- https://master.php.net/note/delete/109796/useless
Del: bad code -- https://master.php.net/note/delete/109796/bad+code
Del: spam -- https://master.php.net/note/delete/109796/spam
Del: non-english -- https://master.php.net/note/delete/109796/non-english
Del: in docs -- https://master.php.net/note/delete/109796/in+docs
Del: other reasons-- https://master.php.net/note/delete/109796
Reject -- https://master.php.net/note/reject/109796
Search -- https://master.php.net/manage/user-notes.php