From 3166cc92d68508a069843625bd8056d6bd75d357 Mon Sep 17 00:00:00 2001 From: Nicolas Ramz Date: Fri, 24 Jul 2015 15:10:25 +0200 Subject: [PATCH] FIXED: correctly decode utf8 characters so selector can safely be used with any utf8 encoded html string (issue #7) --- selector.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selector.inc b/selector.inc index 6e59f38..f08ad09 100644 --- a/selector.inc +++ b/selector.inc @@ -70,12 +70,12 @@ function element_to_array($element) { $array = array( 'name' => $element->nodeName, 'attributes' => array(), - 'text' => $element->textContent, + 'text' => utf8_decode($element->textContent), 'children' =>elements_to_array($element->childNodes) ); if ($element->attributes->length) foreach($element->attributes as $key => $attr) - $array['attributes'][$key] = $attr->value; + $array['attributes'][$key] = utf8_decode($attr->value); return $array; }