truncatechars_html

For ticket #19496 and should now fix the issue of having a white space rather than an additional character

Also fixed truncatechars as this had become broken in the original version