From 52ced90c535518482618ff726eb5c512da40b203 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Wed, 28 Mar 2012 13:03:54 +0000 Subject: Replace htmlspecialchars side effect with grapheme_strlen returning null on invalid utf-8 --- it.class | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/it.class b/it.class index 6d516c9..b4a0d9e 100644 --- a/it.class +++ b/it.class @@ -416,7 +416,7 @@ static function grep($pattern, $array, $p = array()) */ function any2utf8($value) { - return strlen($value) && strlen(htmlspecialchars($value, 0, 'utf-8')) == 0 ? utf8_encode($value) : $value; # Use side-effect of htmlspecialchars: Fails if not valid utf-8 encoding + return grapheme_strlen($value) === null ? utf8_encode($value) : $value; } /** -- cgit v1.2.3