This is not what HtmlEncode and HtmlDecode . Even close.
These methods are designed to "shield" HTML. < becomes < , > becomes > etc. You use them to avoid user input, to avoid cross-site scripting attacks and related problems.
If you want to be able to enter text input and convert it to HTML, consider a formatting tool like Markdown (I believe that Qaru uses MarkdownSharp ).
If all you need is line breaks, you can use text.Replace("\r\n", "<br/>") , but working with more complex structures such as ordered lists is difficult, and there are already existing tools for processing it.
Aaronaught
source share