twig striptags and html special chars

前端 未结 5 1614
小蘑菇
小蘑菇 2021-01-04 00:23

I am using twig to render a view and I am using the striptags filter to remove html tags. However, html special chars are now rendered as text as the whole element is surrou

5条回答
  •  南方客
    南方客 (楼主)
    2021-01-04 00:39

    I had a similar issue, this worked for me:

    {{ variable |convert_encoding('UTF-8', 'HTML-ENTITIES') | raw }}
    

提交回复
热议问题