printing character ' and " in asp using vbscript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • S N

    printing character ' and " in asp using vbscript

    how to print apostrophe character ' and double quote " in asp using
    vbscript.
    my code using response.write replaces " character with inverted question
    mark.
    please help


  • S N

    #2
    Re: printing character ' and " in asp using vbscript

    how to print apostrophe character ' and double quote " in asp using
    vbscript. my code using response.write replaces " character with question
    mark.
    please help


    Comment

    • Jon Paal [MSMD]

      #3
      Re: printing character ' and " in asp using vbscript

      '************** *************** *************** *************** *******
      Function DataPrep(strTex t)
      '
      'PURPOSE: prep data text entry
      '
      'PARAMETERS: strText -- text string to modify
      '************** *************** *************** *************** *******
      If NOT isNull(strText) then

      DataPrep = Replace(strText , ";", "")
      DataPrep = Replace(DataPre p, "'", "'")
      DataPrep = Replace(DataPre p, """", """)
      DataPrep = Replace(DataPre p, "<", "&lt;")
      DataPrep = Replace(DataPre p, ">", "&gt;")

      End if

      End Function




      "S N" <uandme72@yahoo .comwrote in message news:OCmJVc5hIH A.4076@TK2MSFTN GP05.phx.gbl...
      how to print apostrophe character ' and double quote " in asp using vbscript.
      my code using response.write replaces " character with inverted question mark.
      please help
      >
      >

      Comment

      • Bob Barrows [MVP]

        #4
        Re: printing character ' and &quot; in asp using vbscript

        Jon Paal [MSMD] wrote:
        '************** *************** *************** *************** *******
        Function DataPrep(strTex t)
        '
        'PURPOSE: prep data text entry
        '
        'PARAMETERS: strText -- text string to modify
        '************** *************** *************** *************** *******
        If NOT isNull(strText) then
        >
        DataPrep = Replace(strText , ";", "")
        DataPrep = Replace(DataPre p, "'", "&apos;")
        DataPrep = Replace(DataPre p, """", "&quot;")
        DataPrep = Replace(DataPre p, "<", "&lt;")
        DataPrep = Replace(DataPre p, ">", "&gt;")
        >
        End if
        >
        End Function
        >
        ??
        What's wrong with

        Response.Write Server.HTMLEnco de(strText)

        --
        Microsoft MVP - ASP/ASP.NET
        Please reply to the newsgroup. This email account is my spam trap so I
        don't check it very often. If you must reply off-line, then remove the
        "NO SPAM"


        Comment

        • Jon Paal [MSMD]

          #5
          Re: printing character ' and &quot; in asp using vbscript

          "Dataprep" type function allows for customization, otherwise nothing wrong with your suggested solution...


          Comment

          • Evertjan.

            #6
            Re: printing character ' and &quot; in asp using vbscript

            Jon Paal [MSMD] wrote on 17 mrt 2008 in
            microsoft.publi c.inetserver.as p.general:
            "Dataprep" type function allows for customization, otherwise nothing
            wrong with your suggested solution...
            whose?

            --
            Evertjan.
            The Netherlands.
            (Please change the x'es to dots in my emailaddress)

            Comment

            • msnews

              #7
              Re: printing character ' and &quot; in asp using vbscript

              where to get the values of constants like &apos and &quot
              also i want to replace single " and not double ""

              please advise

              "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot comwrote in message
              news:13tqv4u4qe gn7c8@corp.supe rnews.com...
              '************** *************** *************** *************** *******
              Function DataPrep(strTex t)
              '
              'PURPOSE: prep data text entry
              '
              'PARAMETERS: strText -- text string to modify
              '************** *************** *************** *************** *******
              If NOT isNull(strText) then
              >
              DataPrep = Replace(strText , ";", "")
              DataPrep = Replace(DataPre p, "'", "&apos;")
              DataPrep = Replace(DataPre p, """", "&quot;")
              DataPrep = Replace(DataPre p, "<", "&lt;")
              DataPrep = Replace(DataPre p, ">", "&gt;")
              >
              End if
              >
              End Function
              >
              >
              >
              >
              "S N" <uandme72@yahoo .comwrote in message
              news:OCmJVc5hIH A.4076@TK2MSFTN GP05.phx.gbl...
              >how to print apostrophe character ' and double quote " in asp using
              >vbscript.
              >my code using response.write replaces " character with inverted question
              >mark.
              >please help
              >>
              >>
              >
              >

              Comment

              • Jon Paal [MSMD]

                #8
                Re: printing character ' and &quot; in asp using vbscript

                The solutions provided work for others. The problem you have is not an ASP problem per se.

                I suspect you will need to look elsewhere in your database/server/browser to find the problem.

                I suggest you start debugging by allowing the page to be viewed by someone else with another browser so you can start eliminating
                variables.

                Narrow down the problem to where it can be isolated and then you may be able to resolve this matter.


                Comment

                • S N

                  #9
                  Re: printing character ' and &quot; in asp using vbscript

                  which group should i consult. please help

                  "Jon Paal [MSMD]" <Jon nospam Paal @ everywhere dot comwrote in message
                  news:13ufof3gdv avcd3@corp.supe rnews.com...
                  The solutions provided work for others. The problem you have is not an
                  ASP problem per se.
                  >
                  I suspect you will need to look elsewhere in your database/server/browser
                  to find the problem.
                  >
                  I suggest you start debugging by allowing the page to be viewed by someone
                  else with another browser so you can start eliminating variables.
                  >
                  Narrow down the problem to where it can be isolated and then you may be
                  able to resolve this matter.
                  >

                  Comment

                  • Jon Paal [MSMD]

                    #10
                    Re: printing character ' and &quot; in asp using vbscript

                    I would start here:

                    microsoft.publi c.scripting.vbs cript


                    Comment

                    • Anthony Jones

                      #11
                      Re: printing character ' and &quot; in asp using vbscript

                      "S N" <uandme72@yahoo .comwrote in message
                      news:uCtqModjIH A.4196@TK2MSFTN GP04.phx.gbl...
                      which group should i consult. please help
                      >
                      This as good a group as any to get help with this issue.

                      My current guess is that the data has been entered by a Form post via ASP.
                      In correct codepage settings have corrupted the data entered into the DB.


                      --
                      Anthony Jones - MVP ASP/ASP.NET



                      Comment

                      • Mike Brind [MVP]

                        #12
                        Re: printing character ' and &quot; in asp using vbscript


                        "S N" <uandme72@yahoo .comwrote in message
                        news:OI%23$718m IHA.2304@TK2MSF TNGP05.phx.gbl. ..
                        >As Anthony said, if you are entering html code into the database with the
                        >idea that this takes effect when you pull it back to a web page, you do
                        >not
                        >want to server.htmlenco de it. Since you are using a Rich Text Editor, I
                        >am
                        >assuming that this will apply html tags to the text on entry, and you
                        >want
                        >them to act on the output.
                        >>
                        >What you really want to do is to make sure no javascript or clientside
                        >vbscript gets injected. One way to do this is just to reject any input
                        >that
                        >contains the string "<script>" in it during your server-side validation.
                        >>
                        >--
                        >Mike Brind
                        >Microsoft MVP - ASP/ASP.NET
                        >>
                        >
                        >
                        you have guessed it very correctly that i am entering html code into the
                        database (like table tags <td <trin particular) with the
                        idea that this takes effect when it is pulled back to a web page, and
                        hence i dont want to server.htmlenco de it.
                        >
                        can you suggest a server side validation script which does as indicated
                        below by you. else can you suggest an alternate method of achieving
                        the above (ensuring the table tags get translated into tables on the
                        client side).
                        'input is the posted content from the Rich Text Editor

                        If InStr(input, "<string>") 0 Then
                        'reject it
                        Else
                        'process it
                        End If

                        --
                        Mike Brind
                        Microsoft MVP - ASP/ASP.NET


                        Comment

                        Working...