[Pkg-javascript-commits] [node-entities] 11/63: Fix the ranges in the notUTF8 regex

Wolfgang Borgert debacle at moszumanska.debian.org
Mon Sep 22 08:15:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository node-entities.

commit 1c32ab6f02d3a5c1f19fdb415861e53876b735f5
Author: Mark Holmquist <mtraceur at member.fsf.org>
Date:   Wed Feb 27 16:58:28 2013 -0800

    Fix the ranges in the notUTF8 regex
    
    This was breaking a downstream project, this fix should be closer to what the
    XML spec designates as valid entities:
    
    http://www.w3.org/TR/REC-xml/#NT-NameStartChar
---
 index.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/index.js b/index.js
index c175220..9f09edb 100644
--- a/index.js
+++ b/index.js
@@ -2,7 +2,7 @@ var re_hex = /&#x[\da-f]+;?/gi,
 	re_strictHex = /&#x[\da-f]+;/gi,
 	re_charCode = /&#\d+;?/g,
 	re_strictCharCode = /&#\d+;/g,
-	re_notUTF8 = /[\u0000-\u001f\u007f-\uffff]/g,
+	re_notUTF8 = /[\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]/g,
 	fromCharCode = String.fromCharCode,
 	num_func = function(num){return fromCharCode(parseInt(num.substr(2), 10));},
 	hex_func = function(hex){return fromCharCode(parseInt(hex.substr(3), 16));},
@@ -35,7 +35,7 @@ var getReverse = function(obj){
 	return {
 		func: function(name){ return "&" +reverse[name]; },
 		re: new RegExp("\\" +Object.keys(reverse).sort().join("|\\"), "g")
-	}	
+	};
 };
 
 var modes = ["XML", "HTML4", "HTML5"];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-entities.git



More information about the Pkg-javascript-commits mailing list