Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: unpacking - html re-encoding?

by alfie (Pilgrim)
on Jul 18, 2001 at 11:09 UTC ( [id://97564]=note: print w/replies, xml ) Need Help??


in reply to unpacking - html re-encoding?

You might find the quotemeta function quite useful - it's exactly for this purposes.

Update: Alright - I shot before finish reading :/
About converting special characters: The CGI module gives you the function you need to do that.
About the date-check: m/\d{4}-\d{2}-\d{2}/ should do the trick - read perlre for why.

And finally, about mailing you: Sorry, I don't do that stuff. If one is searching for help in a special place s/he should also check back there for the answers - that's the way a community works, by sharing the thoughts. Especially on topics like this. It is easy that I might have missed the one or the other thing (like simply stated by this update ;) - others might add to it. That's not possible if I would have mailed you.... Think of it.
--
use signature; signature(" So long\nAlfie");

Replies are listed 'Best First'.
Re: Re: unpacking - html re-encoding?
by iakobski (Pilgrim) on Jul 18, 2001 at 11:26 UTC
    quotemeta is close but not a perfect fit. It will escape (with a backslash) any non-alphanumeric which includes ALL punctuation and even spaces.

    In most dialects of SQL, quotes are escaped by doubling them:

    he said, "I'LL be back"
    Would need to become:
    'he said, "I''LL be back"'
    Using the example given by the questioner. There's no need to escape other punctuation or spaces. And I said most, because the quoting given by DBI::quote() will match that required by the database transparently.

    Update OK, alfie so you updated your reply while I was writing that. And ++ for the bit about asking for an e-mail.

    -- iakobski

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-24 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found