Convert special chars to HTML entities, without changing tags and parameters

前端 未结 3 1740
生来不讨喜
生来不讨喜 2021-01-16 18:57

I\'m using FreeTextBox editor to get some HTML created by users. The problem with this is this editor is not converting special chars in HTML entities at exception of \"<

3条回答
  •  太阳男子
    2021-01-16 19:14

    I would suggest parsing through each element using Linq to Xml and encoding the value of each element and attribute node. I'll try to come up with some code but hey it's 5pm on a Friday!

提交回复
热议问题