Replace HTML

Discussion in 'ASP General' started by John Smith, Jun 27, 2005.

  1. John Smith

    John Smith Guest

    Hi,

    I'm building a search engine for a site that uses HTML in the content
    management. I wanted to return search results but also filter out any HTML
    code that might interfere with the search results formatting. Is there an
    easy way of doing this or am I left with the option of using replace against
    various tags ?

    Thanks

    J.
    John Smith, Jun 27, 2005
    #1
    1. Advertising

  2. John Smith

    Curt_C [MVP] Guest

    John Smith wrote:
    > Hi,
    >
    > I'm building a search engine for a site that uses HTML in the content
    > management. I wanted to return search results but also filter out any HTML
    > code that might interfere with the search results formatting. Is there an
    > easy way of doing this or am I left with the option of using replace against
    > various tags ?
    >
    > Thanks
    >
    > J.
    >
    >


    Do a search for HTMLDeCode.. I know there have been a whole bunch of
    versions of this written by individuals over the years.

    --
    Curt Christianson
    site: http://www.darkfalz.com
    blog: http://blog.darkfalz.com
    Curt_C [MVP], Jun 27, 2005
    #2
    1. Advertising

  3. John Smith

    John Smith Guest

    "Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
    news:%...
    > John Smith wrote:
    >> Hi,
    >>
    >> I'm building a search engine for a site that uses HTML in the content
    >> management. I wanted to return search results but also filter out any
    >> HTML code that might interfere with the search results formatting. Is
    >> there an easy way of doing this or am I left with the option of using
    >> replace against various tags ?
    >>
    >> Thanks
    >>
    >> J.

    >
    > Do a search for HTMLDeCode.. I know there have been a whole bunch of
    > versions of this written by individuals over the years.
    >
    > --
    > Curt Christianson
    > site: http://www.darkfalz.com
    > blog: http://blog.darkfalz.com


    The only one i could find that wasn't .net was :

    http://www.devx.com/vb2themax/Tip/19163

    Which only seems to convert HTML sent using the GET method to it's proper
    HTML equivilent ?

    Am I missing something ? :)
    John Smith, Jun 27, 2005
    #3
  4. John Smith

    Roland Hall Guest

    "John Smith" wrote in message news:...
    : "Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
    : news:%...
    : > John Smith wrote:
    : >> Hi,
    : >>
    : >> I'm building a search engine for a site that uses HTML in the content
    : >> management. I wanted to return search results but also filter out any
    : >> HTML code that might interfere with the search results formatting. Is
    : >> there an easy way of doing this or am I left with the option of using
    : >> replace against various tags ?
    : >>
    : >> Thanks
    : >>
    : >> J.
    : >
    : > Do a search for HTMLDeCode.. I know there have been a whole bunch of
    : > versions of this written by individuals over the years.
    : >
    : > --
    : > Curt Christianson
    : > site: http://www.darkfalz.com
    : > blog: http://blog.darkfalz.com
    :
    : The only one i could find that wasn't .net was :
    :
    : http://www.devx.com/vb2themax/Tip/19163
    :
    : Which only seems to convert HTML sent using the GET method to it's proper
    : HTML equivilent ?
    :
    : Am I missing something ? :)

    Don't remember where I got this or if it's what you're looking for...

    Private Function HTMLDecode(byVal encodedstring)
    Dim tmp, i
    tmp = encodedstring
    tmp = Replace(tmp, "&quot;", chr(34))
    tmp = Replace(tmp, "&lt;" , chr(60))
    tmp = Replace(tmp, "&gt;" , chr(62))
    tmp = Replace(tmp, "&amp;" , chr(38))
    tmp = Replace(tmp, "&nbsp;", chr(32))
    For i = 1 to 255
    tmp = Replace(tmp, "&#" & i & ";", chr(i))
    Next
    HTMLDecode = tmp
    End Function

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
    Roland Hall, Jun 28, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Blais
    Replies:
    1
    Views:
    366
    Bruno Desthuilliers
    Jun 27, 2006
  2. Greg Ewing
    Replies:
    2
    Views:
    334
    Dieter Maurer
    Jun 29, 2006
  3. Alun
    Replies:
    3
    Views:
    4,482
    Masudur
    Feb 18, 2008
  4. Prasad S
    Replies:
    2
    Views:
    215
    Dr John Stockton
    Aug 27, 2004
  5. Replies:
    3
    Views:
    168
    Brian McCauley
    Sep 12, 2005
Loading...

Share This Page