in reply to Re: Trouble Getting Local Variable $_ to return reformatted string
in thread Trouble Getting Local Variable $_ to return reformatted string

They certainly can and do and sometimes that will bork stuff... but I don't know any way a simple tick could, in your word "break" the HTML page; an ASCII "'" does NOT (in my experience) cause any issue with a browser's rendering. Perhaps this is merely incautious phrasing, but if not, I'd be interested in an example to clarify my understanding.

Attribute values inside an HTML element, when you're using the same type of quotes around the element in question:

<img alt='Bob's Birthday Party' src='birthday.jpg' height='480' width='640'>

You might have the same issue with double quotes, if you're double quoting the values of the attributes.

  • Comment on Re^2: Trouble Getting Local Variable $_ to return reformatted string
  • Download Code

Replies are listed 'Best First'.
Re^3: Trouble Getting Local Variable $_ to return reformatted string
by ww (Archbishop) on Jun 18, 2007 at 16:23 UTC
    You're right, of course and thank you. The apostrophe (as a straight tick) inside your single quoted alt would definitely be a problem.

    However, my "incautious phrasing" perhaps led you to this.

    I see no indication that OP was allowing customers insert anything inside .html elements, tags or values. (And -- aside -- he's fetching the data from a database, which might suggest the cleanup should occur before the customers are allowed to insert it there)

    So, rephrasing:

    ...a simple tick (in the kind of data context presented by the OP) could, in....

    And, again, thank you. That kind of good-catch may save much grief for some future reader presented with my ill-considered words
        ...and I surely hope this is more precise