Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Double Quotes in form hidden field values

by dorward (Curate)
on Jun 15, 2006 at 13:18 UTC ( [id://555495]=note: print w/replies, xml ) Need Help??


in reply to Double Quotes in form hidden field values

See HTML 4.01 section 3.2.2 Attributes:

By default, SGML requires that all attribute values be delimited using either double quotation marks (ASCII decimal 34) or single quotation marks (ASCII decimal 39). Single quote marks can be included within the attribute value when the value is delimited by double quote marks, and vice versa. Authors may also use numeric character references to represent double quotes (") and single quotes ('). For double quotes authors can also use the character entity reference ".

You don't actually need to think about this though, a module such as HTML::Entities will convert strings to use HTML safe characters for you. As a rule of thumb, just run every bit of data through it before stuffing it into your template.

Replies are listed 'Best First'.
Re^2: Double Quotes in form hidden field values
by pickledegg (Novice) on Jun 15, 2006 at 13:34 UTC
    Turns out it wasn't perl related. Its just that I wasn't sure which category it fell into until I'd found a solution.:)

    I just use single quotes to delimit the attribute. Thanks.
      I just use single quotes to delimit the attribute.
      ... which works until someone has a single-quote in the value. Or both a single and double quote. Or an ampersand.

      No, the proper thing here is to learn to escape properly. Other solutions have already been given in this thread. Pay attention to them.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://555495]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-23 09:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found