- fix rc_utf8_clean() issues (#1486407)

release-0.6
alecpl 15 years ago
parent 57837fd689
commit 6481d4bbbe

@ -515,10 +515,10 @@ function rc_utf8_clean($input)
return $input; return $input;
// iconv/mbstring are much faster (especially with long strings) // iconv/mbstring are much faster (especially with long strings)
if (function_exists('mb_convert_encoding') && ($res = mb_convert_encoding($input, 'UTF8', 'UTF8')) !== false) if (function_exists('mb_convert_encoding') && ($res = mb_convert_encoding($input, 'UTF-8', 'UTF-8')) !== false)
return $res; return $res;
if (function_exists('iconv') && ($res = iconv('UTF8', 'UTF8//IGNORE', $input)) !== false) if (function_exists('iconv') && ($res = iconv('UTF-8', 'UTF-8//IGNORE', $input)) !== false)
return $res; return $res;
$regexp = '/^('. $regexp = '/^('.
@ -536,7 +536,7 @@ function rc_utf8_clean($input)
$seq = ''; $seq = '';
$out = ''; $out = '';
for ($i = 0, $len = strlen($input)-1; $i < $len; $i++) { for ($i = 0, $len = strlen($input); $i < $len; $i++) {
$chr = $input[$i]; $chr = $input[$i];
$ord = ord($chr); $ord = ord($chr);
// 1-byte character // 1-byte character

Loading…
Cancel
Save