Currently the truncate twig filter might cut off encoded entities or cut strings to early if encoded entities are within it, this changes should prevent that.
as it is security related (could introduce xss), before we could merge this we would need unit tests.
actually it shouldn't be security related, as it doesn't change the string. But can add some test nevertheless.
Added some simple tests...