Problem with output text

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • viki1967
    Contributor
    • Oct 2007
    • 263

    Problem with output text

    Problem with output text

    Hi all.

    I have this page ASP:


    Code:
    <!-- #include virtual="/include/conn_mysql.asp"-->
    
    <%
    
    response.Expires = -1500
    response.AddHeader "PRAGMA", "NO-CACHE"
    response.AddHeader "CACHE-CONTROL", "PRIVATE"
    response.CacheControl = "PRIVATE"
    
    session.LCID = 1040
    
    strCod = request.querystring("id")
    
    strSQL = "SELECT * FROM tbl_1 WHERE id = " & strCod
    Set objRs = Server.CreateObject("ADODB.Recordset") 
    objRs.Open strSQL, cn 
    
    strArticolo = objRs("testo")
    strParole = split(strArticolo," ")
    intParole = ubound(strParole)
    intQuante = cint( intParole / 1.9 ) 
    ctind = 0
    strTesto = ""
    
    %>
    
    <!-- code HTML -->
    
    <%
    for ctInd = 0 to intQuante
    strTesto=strTesto & strParole(ctInd) & " "
    next
    %>
    
    <!-- first column -->
    <%=strTesto%>
    
    <%
    strTesto=""
    for ctInd = (intQuante + 1) to ubound(strParole)
    strTesto = strTesto & strParole(ctInd) & " "
    next
    %>
    
    <!-- second column -->
    <%=strTesto%>
    
    
    <%
    
    objRs.Close
    Set objRs = Nothing
    
    cn.Close
    Set cn = Nothing
    
    %>
    The output is the text divided on two columns as a image attached in this thread.

    My problem is that in the first row of the second column I see formatted text registering in db, for example:

    style="font-size: 12pt;">text, text, text....
    Can you help me?

    Viki
    Attached Files
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi Viki,

    What exactly do you mean by registering in db? Are unexpected characters being saved in the database or are they being written to the screen?

    Dr B

    Comment

    • viki1967
      Contributor
      • Oct 2007
      • 263

      #3
      Originally posted by DrBunchman
      Hi Viki,

      What exactly do you mean by registering in db? Are unexpected characters being saved in the database or are they being written to the screen?

      Dr B
      Hi Dr.

      Thanks x your reply.

      I attach the screenshot with problem.
      Attached Files

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        I don't see any style tags in your example above so presumably it's not being accidentally written to the page from your html/asp code?

        Does that mean that you are accidentally storing style information in the database? Can you check the contents of the database to see if this is the case?

        Dr B

        Comment

        • viki1967
          Contributor
          • Oct 2007
          • 263

          #5
          This is one example the text registered in the DB MySQL:

          Code:
          <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: justify;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 14pt;"><span style="font-size: x-small; font-family: Times New Roman;">CHI SONO GLI ANGELI</span></span></strong></p>
          <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: justify;"><span style="font-size: 14pt;"><span style="font-size: x-small; font-family: Times New Roman;">&nbsp;</span></span></p>
          The text is formatted by the script FCKeditor

          Comment

          • DrBunchman
            Recognized Expert Contributor
            • Jan 2008
            • 979

            #6
            Do you mean that you are storing the formatting information in the database?

            Dr B

            Comment

            • viki1967
              Contributor
              • Oct 2007
              • 263

              #7
              Originally posted by DrBunchman
              Do you mean that you are storing the formatting information in the database?

              Dr B
              Sorry I don't understand your answer.

              Comment

              • DrBunchman
                Recognized Expert Contributor
                • Jan 2008
                • 979

                #8
                Sorry Viki, what I mean is: are you storing the style mark up in the database? So rather than just storing values you are actually storing html or css?

                Or have i completely misunderstood you!?

                Dr B

                Comment

                • viki1967
                  Contributor
                  • Oct 2007
                  • 263

                  #9
                  OK.

                  The text in the row of the database is this:

                  <p class="MsoNorma l" style="margin: 0cm 0cm 0pt; text-align: justify;"><stro ng style="mso-bidi-font-weight: normal;"><span style="font-size: 14pt;"><span style="font-size: x-small; font-family: Times New Roman;">CHI SONO GLI ANGELI</span></span></strong></p>
                  <p class="MsoNorma l" style="margin: 0cm 0cm 0pt; text-align: justify;"><span style="font-size: 14pt;"><span style="font-size: x-small; font-family: Times New Roman;">&nbsp;</span></span></p>


                  Not CSS, Not HTML.

                  Comment

                  • DrBunchman
                    Recognized Expert Contributor
                    • Jan 2008
                    • 979

                    #10
                    That is HTML.

                    The problem is probably all the double quotes that you are storing in the database - remember that these are string delimiters in ASP so when you write them to the screen they will truncate your strings.

                    If you replace the double quotes with single quotes when you get the data does that help at all? e.g.
                    Code:
                    Response,Write Replace(rs("column"), """", "'")
                    Let me know how it goes,

                    Dr B

                    Comment

                    • viki1967
                      Contributor
                      • Oct 2007
                      • 263

                      #11
                      Hi Dr, please try this link and see the start of second column:

                      Comment

                      • DrBunchman
                        Recognized Expert Contributor
                        • Jan 2008
                        • 979

                        #12
                        I see what you mean.

                        I think, judging by this post, that FCKEditor might be causing the problem but I've never used it before so I don't know.

                        Anybody else got any experience with it?

                        Dr B

                        Comment

                        Working...