RE: [PHP] escaping quotes for redisplay
| From: | Ford, Mike [LSS] | Date: | Wed, 19 Feb 2003 11:28:26 +0000 |
| Subject: | RE: [PHP] escaping quotes for redisplay | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-136141@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Erik Price [mailto:erikprice@mac.com]
> Sent: 18 February 2003 18:11
>
> PS: I am using htmlentities() on the output before displaying
> it in the
> browser, but it doesn't apply to singlequotes.
Ahem! I quote from http://www.php.net/manual/en/function.htmlentities.php:
> ... the optional second quote_style parameter lets you define
> what will be done with 'single' and "double" quotes. It takes
> on one of three constants with the default being ENT_COMPAT:
>
> Constant Name Description
> ENT_COMPAT Will convert double-quotes and leave single-
> quotes alone.
> ENT_QUOTES Will convert both double and single quotes.
> ENT_NOQUOTES Will leave both double and single quotes
> unconverted.
So just use htmlentities($output, ENT_QUOTES).
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211