A very lightweight tool to HTML encode your source-code (or anything really) and surround it in a pre-block. Perfect for posting on your website or blog.
private void btnEncode_Click(object sender, EventArgs e)
{
var sb = new StringBuilder();
sb.AppendLine("<pre>");
sb.AppendLine(WebUtility.HtmlEncode(rtxt.Text));
sb.AppendLine("</pre>");
rtxt.Text = sb.ToString();
rtxt.SelectionStart = 0;
rtxt.SelectionLength = rtxt.TextLength;
}
Basically just a wrapper around the WebUtility.HtmlEncode method and a GUI for ease of use.
You will need to do the GUI yourself and compile it. Look at Visual Studio Community Edition for a place to start.
Hope this helps someone out there ;)


No comments:
Post a Comment