fix #168 for Latvian special chars and numerical entities visibility in excerpt

This commit is contained in:
ajya 2017-10-30 13:17:48 +00:00
parent 71a3f6ff38
commit d4e1ad25c0

View file

@ -136,6 +136,8 @@ function get_html_translation_table (table, quote_style) {
entities['253'] = 'ý'; entities['253'] = 'ý';
entities['254'] = 'þ'; entities['254'] = 'þ';
entities['255'] = 'ÿ'; entities['255'] = 'ÿ';
entities['352'] = 'Š';
entities['353'] = 'š';
} }
if (useQuoteStyle !== 'ENT_NOQUOTES') { if (useQuoteStyle !== 'ENT_NOQUOTES') {
entities['34'] = '"'; entities['34'] = '"';
@ -190,6 +192,10 @@ function html_entity_decode (string, quote_style) {
tmp_str = tmp_str.split(entity).join(symbol); tmp_str = tmp_str.split(entity).join(symbol);
} }
tmp_str = tmp_str.split(''').join("'"); tmp_str = tmp_str.split(''').join("'");
//decode numeric html entities
tmp_str = tmp_str.replace(/&#([0-9]{1,3});/gi, function(match, numStr) {
var num = parseInt(numStr, 10);
return String.fromCharCode(num);
});
return tmp_str; return tmp_str;
} }