summaryrefslogtreecommitdiff
path: root/src/HTML5/Parser
diff options
context:
space:
mode:
authorAlexander <[email protected]>2016-01-26 11:57:11 +0200
committerlayershifter <[email protected]>2016-01-31 14:37:26 +0200
commit9d94fa59fd07cfc09dc80b1e1a3ab67d47da9ed8 (patch)
tree9602de31ad74a86ff981804b32a3fef8d1173383 /src/HTML5/Parser
parent9c1c1238dd9f711cec5c63fc5cd2fa8262380c9d (diff)
Issue #94 UTF8Utils::countChars() - extra bad perfomance with iconv_strlen()
Diffstat (limited to 'src/HTML5/Parser')
-rw-r--r--src/HTML5/Parser/UTF8Utils.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/HTML5/Parser/UTF8Utils.php b/src/HTML5/Parser/UTF8Utils.php
index 9afb5ea..684d84a 100644
--- a/src/HTML5/Parser/UTF8Utils.php
+++ b/src/HTML5/Parser/UTF8Utils.php
@@ -50,6 +50,8 @@ class UTF8Utils
// Get the length for the string we need.
if (function_exists('mb_strlen')) {
return mb_strlen($string, 'utf-8');
+ } elseif (function_exists('iconv_strlen')) {
+ return iconv_strlen($string, 'utf-8');
} elseif (function_exists('utf8_decode')) {
// MPB: Will this work? Won't certain decodes lead to two chars
// extrapolated out of 2-byte chars?