Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix decoding numeric entities

  • Loading branch information...
commit 3a8ebc5790bc1194ce8f0fefab2ab562f6bd5d4c 1 parent b116f4c
Andris Reinman authored
Showing with 4 additions and 4 deletions.
  1. +3 −3 lib/nodepie.js
  2. +1 −1  package.json
6 lib/nodepie.js
View
@@ -108,11 +108,11 @@ NodePie.HTMLEntities = {
* Decodes any HTML entities in a string into their unicode form
**/
NodePie._decodeHTMLEntities = function(text){
- return text.replace(/&(.+?);/g, function(str, ent){
- if(ent[0] !== '#'){
+ return text.replace(/&(#?[a-z0-9]+?);/ig, function(str, ent){
+ if(ent.charAt(0) !== '#'){
return NodePie.HTMLEntities[ent] || str;
}else{
- return ent[1] === 'x' ? parseInt(ent.substr(2),16) : parseInt(ent.substr(1), 10);
+ return String.fromCharCode(ent.charAt(1) === 'x' ? parseInt(ent.substr(2),16) : parseInt(ent.substr(1), 10));
}
}
);
2  package.json
View
@@ -1,7 +1,7 @@
{
"name": "nodepie",
"description": "RSS/Atom parser for Node.JS",
- "version": "0.5.3",
+ "version": "0.5.4",
"author" : "Andris Reinman",
"maintainers":[
{
Please sign in to comment.
Something went wrong with that request. Please try again.