How do I make a string HTML-worthy?

Results 1 to 2 of 2

Thread: How do I make a string HTML-worthy?

  1. #1
    Jim d. Guest

    Default How do I make a string HTML-worthy?

    Hello All,<BR><BR>Basically, I&#039m looking for a way to filter a string that I pull from a database so that it&#039s safe to put it on the web. Specifically, I&#039m looking to replace all special characters with their proper "escape codes"<BR><BR>For example, if a string contains the &#060; or &#062; symbols, and I just spit them to a page, a browser would interpret this as a tag. I would want to replace those accurances with &amp;lt; and &amp;gt;. <BR><BR>Sure, I could use the replace function for the above example, but it seems like it would be costly to do this for EVERY special character.<BR><BR>Is there a simple way to do this with VBScript, or perhaps a tool that I could download that would solve this problem?<BR><BR>Thanks,<BR>Jim

  2. #2
    Join Date
    Dec 1969

    Default Response.Write Server.HTMLEncode( rawString )

    Response.Write Server.HTMLEncode( rawString )<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts