what's the best way to handle single & double quotes?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

what's the best way to handle single & double quotes?

Post by someguyhere »

I'm working on a plugin for wordpress, and one of the fields is a bio field. Is there a good/right way to safely turn regular quotes (like " or ') into curly quotes - and is there a way to turn the quotes pasted from Word into the appropriate quotes rather than them displaying as an unknown character?
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: what's the best way to handle single & double quotes?

Post by social_experiment »

Wouldn't the following suffice : htmlentities($valueToEntitize, ENT_QUOTES)?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
someguyhere
Forum Contributor
Posts: 181
Joined: Sun Jul 27, 2008 3:24 pm

Re: what's the best way to handle single & double quotes?

Post by someguyhere »

No. That doesn't convert regular quotes into curly quotes.
Post Reply