Skip to content
Browse files

Preparing for 1.0.3 release

git-svn-id: http://svn.php.net/repository/pear/packages/XML_Feed_Parser/trunk@269349 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 6ac2cd4 commit 37f79354f6d27db683a773ad9b008476281140d1 James Stewart committed
Showing with 52 additions and 12 deletions.
  1. +13 −4 Parser/Type.php
  2. +35 −6 package2.xml
  3. +4 −2 tests/regressions.php
View
17 Parser/Type.php
@@ -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');
}
/**
@@ -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 */
View
41 package2.xml
@@ -14,10 +14,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
<email>james@jystewart.net</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>
@@ -25,8 +25,15 @@ http://pear.php.net/dtd/package-2.0.xsd">
<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="/">
@@ -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>
@@ -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>
View
6 tests/regressions.php
@@ -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
@@ -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);
}

0 comments on commit 37f7935

Please sign in to comment.
Something went wrong with that request. Please try again.