Announcement

Collapse
No announcement yet.

PBCC misreads adjacent single quotes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PBCC misreads adjacent single quotes

    Hi All,

    When my PBCC application reads a line in a text file that has two adjacent single quotes, it reads then as a single double quote.

    The source file has a line

    abc ='';

    But PBCC reads it using the code

    Line Input #fNum, a$

    and sets the contents of a$ to

    abc =";

    This font makes the source line look very much like the contents of a$, but if you move your cursor over it, you can see it has two ' characters, not one " character.

    I am still using PBCC4, since 5 did not add anything I need, but if the problem is fixed in 5, I will upgrade.

    Thanks,
    Hank Zucker

  • #2
    Hi Hank,

    I could not replicate this problem in PBCC 4.04 or 5.0. I copied and pasted your text directly from the forums:
    Code:
    #COMPILE EXE
    #DIM ALL
    
    FUNCTION PBMAIN () AS LONG
      LOCAL s AS STRING
      LOCAL i AS LONG
      
      OPEN "dump.txt" FOR OUTPUT AS #1
      PRINT #1, "abc ='';"
      CLOSE #1
      
      OPEN "dump.txt" FOR INPUT AS #1
      LINE INPUT #1, s
      CLOSE #1
      
      FOR i = 1 TO LEN(s)
        ? MID$(s, i, 1), ASC(s, i)
      NEXT i
      
      WAITKEY$
    
    END FUNCTION
    Send a compilable example of this to support and include your data file. Thank you.
    Sincerely,

    Steve Rossell
    PowerBASIC Staff

    Comment


    • #3
      Hi Steve,

      Thank you for your reply.

      I now see where the problem is occurring. It is in a CGI application.

      The problem occurs in the WriteCGI sub.

      SUB WriteCGI(BYVAL x AS STRING)

      STATIC header AS LONG

      IF ISFALSE header THEN
      STDOUT "Content-type: text/html" + CHR$(13, 10)
      header = -1
      END IF

      REPLACE "''" WITH CHR$(34) IN x

      STDOUT x

      END SUB

      I see that the current version of your PBCGI.inc file does not include the REPLACE line. I very much doubt that I would have added that line myself, though I suppose it is possible.

      Do you know if that was a change you folks made somewhere along the line? If so, why? I have been using PBCC since 1998 or 9. I've kept using the older version of that inc file for some reason, but do not recall exactly why at the moment. At some point I had a problem using a newer version supplied with an upgrade. So I am reluctant to switch.

      Thanks.
      Hank Zucker

      Comment


      • #4
        I checked 4.0, 4.01, 4.02, 4.03, 4.04, and 5.0 and they all have WriteCGI as:
        Code:
        SUB WriteCGI (BYVAL st AS STRING)
        
            STATIC HEADER AS LONG
        
            IF ISFALSE HEADER THEN
                STDOUT "Content-type: text/html"
                STDOUT
                HEADER = -1
            END IF
        
            STDOUT st
        
        END SUB
        in the \Samples\Internet\CGI\PBCGI.inc file.
        Sincerely,

        Steve Rossell
        PowerBASIC Staff

        Comment


        • #5
          Thanks for checking those, Steve. Could you please also check PBCC3? Is that the version that was current in 1999?

          I upgraded two or three times since 1999, and know there was some reason I kept the older PBCGI.inc file, something that did not work with a newer version of the file. Of course now I wish I'd done a better job of documenting why.

          Thanks again.
          Hank Zucker

          Comment


          • #6
            Hans. It is that way (replace ... ) in pbcc 2.+
            I went from ver. 2-4 so cant check 3 but i suspect it has the replace.
            Client Writeup for the CPA

            buffs.proboards2.com

            Links Page

            Comment


            • #7
              Thanks, Fred. That is very helpful.

              So now we know that Replacing a pair of single quotes was once standard in PBCC. That explains why there wasn't a comment of mine in the sub. I feel somewhat safer deleting the Replace knowing that I did not put it in there to solve some particular problem I was having.

              Steve do you know why the change was made?
              Hank Zucker

              Comment


              • #8
                The change was made in PBCC 3.03.
                Sincerely,

                Steve Rossell
                PowerBASIC Staff

                Comment


                • #9
                  Thanks, Steve.

                  Do you know why the change was made?
                  Hank Zucker

                  Comment


                  • #10
                    Nope, I was not even working here at the time. Sorry.
                    Sincerely,

                    Steve Rossell
                    PowerBASIC Staff

                    Comment

                    Working...
                    X