Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VB/ASP problem - HTML strings in ASP

VB/ASP problem - HTML strings in ASP

Scheduled Pinned Locked Moved Visual Basic
helpjavascripthtmldatabasesysadmin
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dmitry Khudorozhkov
    wrote on last edited by
    #1

    Hi everyone, In the ASP page, I store the output (in the form of html strings) from the rich-text editor in a database; when time comes, I retrieve the required HTML string (I use VB as a server-side language) (htmlCode variable.) The I wish to pass this htmlCode to some JavaScript function:

    <body onload="populateWithHTML('<%=htmlCode%>')">

    BUT! Here is the problem. This html string can contain " (quote) and ' (apostrophe) symbols, that break the resulting HTML. How should I fix this? Thank you much in advance!

    ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

    N 1 Reply Last reply
    0
    • D Dmitry Khudorozhkov

      Hi everyone, In the ASP page, I store the output (in the form of html strings) from the rich-text editor in a database; when time comes, I retrieve the required HTML string (I use VB as a server-side language) (htmlCode variable.) The I wish to pass this htmlCode to some JavaScript function:

      <body onload="populateWithHTML('<%=htmlCode%>')">

      BUT! Here is the problem. This html string can contain " (quote) and ' (apostrophe) symbols, that break the resulting HTML. How should I fix this? Thank you much in advance!

      ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

      N Offline
      N Offline
      nlarson11
      wrote on last edited by
      #2

      server.htmlencode

      D 1 Reply Last reply
      0
      • N nlarson11

        server.htmlencode

        D Offline
        D Offline
        Dmitry Khudorozhkov
        wrote on last edited by
        #3

        server.htmlencode is a .NET method; is there a way to make it in a ordinary (non-.NET) VB and ASP?

        ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

        N 1 Reply Last reply
        0
        • D Dmitry Khudorozhkov

          server.htmlencode is a .NET method; is there a way to make it in a ordinary (non-.NET) VB and ASP?

          ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

          N Offline
          N Offline
          nlarson11
          wrote on last edited by
          #4

          check again. server.HTMLEncode exists in ASP.

          D 1 Reply Last reply
          0
          • N nlarson11

            check again. server.HTMLEncode exists in ASP.

            D Offline
            D Offline
            Dmitry Khudorozhkov
            wrote on last edited by
            #5

            Oops! Thanks a lot. BTW, is there a server.HTMLDecode method?

            ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

            N 1 Reply Last reply
            0
            • D Dmitry Khudorozhkov

              Oops! Thanks a lot. BTW, is there a server.HTMLDecode method?

              ------------------------- Listen up! "Teamwork" means staying out of my way! (Seifer, Final Fantasy 8).

              N Offline
              N Offline
              nlarson11
              wrote on last edited by
              #6

              No problem. No there isn't such a function.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups