Skip to content

Commit

Permalink
Preparing for 1.0.3 release
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.php.net/repository/pear/packages/XML_Feed_Parser/trunk@269349 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
James Stewart committed Nov 19, 2008
1 parent 6ac2cd4 commit 37f7935
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 12 deletions.
17 changes: 13 additions & 4 deletions Parser/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,19 @@ function processXHTMLAttributes($node) {
* @param String
* @return String
*/
function processEntitiesForNodeValue($value)
function processEntitiesForNodeValue($node)
{
$decoded = html_entity_decode($value, NULL, 'utf-8');
return htmlentities($decoded, NULL, 'utf-8');
if (function_exists('iconv')) {
$current_encoding = $node->ownerDocument->encoding;
$value = iconv($current_encoding, 'UTF-8', $node->nodeValue);
} else if ($current_encoding == 'iso-8859-1') {
$value = utf8_encode($node->nodeValue);
} else {
$value = $node->nodeValue;
}

$decoded = html_entity_decode($value, NULL, 'UTF-8');
return htmlentities($decoded, NULL, 'UTF-8');
}

/**
Expand Down Expand Up @@ -366,7 +375,7 @@ function traverseNode($node)
}

if ($node instanceof DOMText) {
$content .= $this->processEntitiesForNodeValue($node->nodeValue);
$content .= $this->processEntitiesForNodeValue($node);
}

/* Add the closing of this node to the content */
Expand Down
41 changes: 35 additions & 6 deletions package2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,26 @@ http://pear.php.net/dtd/package-2.0.xsd">
<email>[email protected]</email>
<active>yes</active>
</lead>
<date>2007-04-09</date>
<time>10:47:00</time>
<date>2008-11-19</date>
<time>13:13:00</time>
<version>
<release>1.0.2</release>
<release>1.0.3</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
<notes>Fixed bug #10499 - AtomElement's xpath is NULL (thanks to Teo Hui Ming)
Fixed bug #10501 -- atom getLink() should query links without rel in special case (thanks to Teo Hui Ming)
<notes>
Bug fix release. Closes:
#13215 - Encoding problems
#12919 - &amp;amp; in ULR's causes problems
#12522 - pubDate handler throws warning on empty field
#12017 - no rss2 image if &lt;itunes:image/> precedes &lt;image>
#11467 - Escaped HTML in Atom Text Constructs
#10702 - Indirect modification of overloaded property
#10336 - Error with encoding handling on xhtml
</notes>
<contents>
<dir name="/">
Expand Down Expand Up @@ -151,6 +158,19 @@ http://pear.php.net/dtd/package-2.0.xsd">
</dependencies>
<phprelease />
<changelog>
<release>
<version>
<release>1.0.3</release>
<api>1.0.1</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<date>2008-11-19</date>
<license uri="http://www.php.net/license">PHP License</license>
<notes>Maintenance release</notes>
</release>
<release>
<version>
<release>1.0.2</release>
Expand All @@ -162,7 +182,16 @@ http://pear.php.net/dtd/package-2.0.xsd">
</stability>
<date>2007-01-09</date>
<license uri="http://www.php.net/license">PHP License</license>
<notes></notes>
<notes>
Bug fix release. Closes:
#13215 - Encoding problems
#12919 - &amp;amp; in ULR's causes problems
#12522 - pubDate handler throws warning on empty field
#12017 - no rss2 image if &lt;itunes:image/> precedes &lt;image>
#11467 - Escaped HTML in Atom Text Constructs
#10702 - Indirect modification of overloaded property
#10336 - Error with encoding handling on xhtml
</notes>
</release>

<release>
Expand Down
6 changes: 4 additions & 2 deletions tests/regressions.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ function test_handlesMultipleEnclosuresInAtom()
$this->assertEquals('http://example.org/audio/ph34r_my_podcast2.mp3', $second['url']);
}


/**
* German umlauts (ÄÖÜäöüß) from an atom xml file (encoding="iso-8859-1")
* German umlauts (ÄÖÜäöüß) from an atom xml file (encoding="iso-8859-1")
* are displayed wrong after parsing, eg. http://www.keine-gentechnik.de/news-regionen.xml
*
* @url http://pear.php.net/bugs/bug.php?id=12916
Expand All @@ -70,6 +69,9 @@ function test_handlesGermanUmlauts()
$xml = file_get_contents($this->sample_dir . "/bug12916.xml");
$feed = new XML_Feed_Parser($xml);
$entry = $feed->getEntryById('sample-feed:1');

// Ensure that the parsed XML equals the input XML
// $this->assertEquals($xml, (string)$feed);
$this->assertEquals('ÄÜÖäüöß', $entry->title);
$this->assertEquals('&Auml;&Uuml;&Ouml;&auml;&uuml;&ouml;&szlig;', $entry->content);
}
Expand Down

0 comments on commit 37f7935

Please sign in to comment.