fix htmlEncode stripping the last character

This commit is contained in:
Lisa Milne 2023-11-11 17:27:52 +10:00
parent 9cff3a7c10
commit ba46d0685b

View file

@ -1292,7 +1292,7 @@ clite.lib = {
// makes text html safe
htmlEncode:function(txt) {
var rtxt = txt.replace(/&/g, '&amp').replace(/>/g, '&gt').replace(/</g, '&lt');
if (rtxt.length > 0 && rtxt[rtxt.length-1])
if (rtxt.length > 0 && rtxt[rtxt.length-1] == ' ')
return rtxt.substring(0,rtxt.length-1)+'&nbsp;';
return rtxt;
},