Skip to content

Commit

Permalink
Slight internal refactoring to make bug more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
CloCkWeRX committed Dec 9, 2011
1 parent a5b4134 commit 002b67d
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions XML/Feed/Parser/Type.php
Expand Up @@ -32,6 +32,7 @@
*/ */
abstract class XML_Feed_Parser_Type abstract class XML_Feed_Parser_Type
{ {
protected $sanitizer;
/** /**
* Where we store our DOM object for this feed * Where we store our DOM object for this feed
* @var DOMDocument * @var DOMDocument
Expand Down Expand Up @@ -340,18 +341,25 @@ function processEntitiesForNodeValue($node)
{ {
$current_encoding = $node->ownerDocument->encoding; $current_encoding = $node->ownerDocument->encoding;


if (function_exists('iconv')) { // Charset left blank to trigger autodetection
return iconv(strtoupper($current_encoding), 'UTF-8', htmlentities(html_entity_decode($node->nodeValue, NULL, 'UTF-8'), NULL, 'UTF-8')); $decoded = html_entity_decode($node->nodeValue);
$value = htmlentities($decoded, null, strtoupper($current_encoding));

if (function_exists('iconv') && false) {
return $this->sanitizer->sanitize(
iconv(
strtoupper($current_encoding),
'UTF-8',
$value
)
);
} else if (strtoupper($current_encoding) == 'ISO-8859-1') { } else if (strtoupper($current_encoding) == 'ISO-8859-1') {
return utf8_encode(htmlentities(html_entity_decode($node->nodeValue, NULL, 'UTF-8'), NULL, 'UTF-8')); return $this->sanitizer->sanitize(
utf8_encode($value)
);
} }


return $this->sanitizer->sanitize( return $this->sanitizer->sanitize($value);
htmlentities(
html_entity_decode($node->nodeValue, NULL, 'UTF-8'),
NULL, 'UTF-8'
)
);
} }


/** /**
Expand Down

0 comments on commit 002b67d

Please sign in to comment.