Thursday, December 27, 2007

Snippet: HTML Encode

This snippet will ensure that text will store inside "markup" languages (i.e. HTML and XML). Nothing elegant... but highly useful. ;)

Click here to download the snippet: HTML Encode

Sample Input:
<Sample>Some common text & such. Lance really likes using the · symbol in S·O·S, doesn't he?</Sample>

Sample Output:
&lt;Sample&gt;Some common text &amp; such. Lance really likes using the &#183; symbol in S&#183;O&#183;S, doesn't he?&lt;/Sample&gt;

No comments: