...
|
...
|
@@ -10,7 +10,7 @@ const htmlEntity = { |
|
|
};
|
|
|
|
|
|
exports.htmlDecode = function(txt) {
|
|
|
txt = txt || '';
|
|
|
txt = txt + '' || '';
|
|
|
return txt.replace(/((&(([a-z][a-z0-9]*)|(#[0-9]+)|(#x[0-9a-f]+));)|["'<>&])/gi, function(s) {
|
|
|
s = s || '';
|
|
|
const s1 = htmlEntity[s.toLowerCase()];
|
...
|
...
|
@@ -24,7 +24,8 @@ exports.htmlDecode = function(txt) { |
|
|
};
|
|
|
|
|
|
exports.htmlEncode = function(str) {
|
|
|
str = str || '';
|
|
|
str = str + '' || '';
|
|
|
|
|
|
return str.replace(re, function(s) {
|
|
|
switch (s) {
|
|
|
case '"':
|
...
|
...
|
|