Skip to content

Commit 9d94fa5

Browse files
Alexanderlayershifter
authored andcommitted
Issue #94 UTF8Utils::countChars() - extra bad perfomance with iconv_strlen()
1 parent 9c1c123 commit 9d94fa5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/HTML5/Parser/UTF8Utils.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public static function countChars($string)
5050
// Get the length for the string we need.
5151
if (function_exists('mb_strlen')) {
5252
return mb_strlen($string, 'utf-8');
53+
} elseif (function_exists('iconv_strlen')) {
54+
return iconv_strlen($string, 'utf-8');
5355
} elseif (function_exists('utf8_decode')) {
5456
// MPB: Will this work? Won't certain decodes lead to two chars
5557
// extrapolated out of 2-byte chars?

0 commit comments

Comments
 (0)