note 93609 added to function.iconv
| From: | phpmanualspam at netebb dot com | Date: | Fri, 18 Sep 2009 06:53:53 +0000 |
| Subject: | note 93609 added to function.iconv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160817@lists.php.net to get a copy of this message | ||
mirek code, dated 16-May-2008 10:17, added the characters `^~'" to the output.
This function will strip out these extra characters:
<?php
setlocale(LC_ALL, 'en_US.UTF8');
function clearUTF($s)
{
$r = '';
$s1 = @iconv('UTF-8', 'ASCII//TRANSLIT', $s);
$j = 0;
for ($i = 0; $i < strlen($s1); $i++) {
$ch1 = $s1[$i];
$ch2 = @mb_substr($s, $j++, 1, 'UTF-8');
if (strstr('`^~\'"', $ch1) !== false) {
if ($ch1 <> $ch2) {
--$j;
continue;
}
}
$r .= ($ch1=='?') ? $ch2 : $ch1;
}
return $r;
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 76.173.241.32
----
Manual Page -- http://www.php.net/manual/en/function.iconv.php
Edit -- https://master.php.net/note/edit/93609
Del: integrated -- https://master.php.net/note/delete/93609/integrated
Del: useless -- https://master.php.net/note/delete/93609/useless
Del: bad code -- https://master.php.net/note/delete/93609/bad+code
Del: spam -- https://master.php.net/note/delete/93609/spam
Del: non-english -- https://master.php.net/note/delete/93609/non-english
Del: in docs -- https://master.php.net/note/delete/93609/in+docs
Del: other reasons-- https://master.php.net/note/delete/93609
Reject -- https://master.php.net/note/reject/93609
Search -- https://master.php.net/manage/user-notes.php