Re: Re: htmlentities
| From: | Johan Lidström | Date: | Wed, 14 Sep 2011 07:39:20 +0000 |
| Subject: | Re: Re: htmlentities | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314834@lists.php.net to get a copy of this message | ||
On 13 September 2011 23:01, Shawn McKenzie <nospam@mckenzies.net> wrote:
> On 09/13/2011 01:38 PM, Ron Piggott wrote:
> >
> > Is there a way to only change accented characters and not HTML (Example:
> <p> </p> <a href =””> </a> )
> >
> > The syntax
> >
> > echo htmlentities(
> stripslashes(mysql_result($whats_new_result,0,"message")) ) . "\r\n";
> >
> > is doing everything (as I expect). I store breaking news within the
> database as HTML formatted text. I am trying to see if a work around is
> available? Do I need to do a variety of search / replace to convert the
> noted characters above back after htmlentities ?
> >
> > (I am just starting to get use to accented letters.)
> >
> > Thanks a lot for your help.
> >
> > Ron
> >
> > The Verse of the Day
> > “Encouragement from God’s Word”
> > http://www.TheVerseOfTheDay.info
> >
>
> If it is meant to be HTML then why run htmlentities(), especially before
> storing it in the DB?
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Perhaps something like this might help you
$content =
htmlspecialchars_decode(htmlentities($content,ENT_NOQUOTES,"ISO-8859-1"),ENT_NOQUOTES);
or perhaps
$table_all =
get_html_translation_table(HTML_ENTITIES,ENT_NOQUOTES,"ISO-8859-1");
$table_html = get_html_translation_table(HTML_SPECIALCHARS,ENT_NOQUOTES);
$table_nonhtml = array_diff_key($table_all,$table_html);
$content1 = strtr($content1,$table_nonhtml);
$content2 = strtr($content2,$table_nonhtml);
if using it multiple times.
--
"It is not possible to simultaneously understand and appreciate the Intel
architecture" --Ben Scott