Re: Convert all named entities into numeric character references
| From: | Jacob Friis Saxberg | Date: | Tue, 14 Mar 2006 08:35:00 +0000 |
| Subject: | Re: Convert all named entities into numeric character references | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231891@lists.php.net to get a copy of this message | ||
Thanks, I could also use Tidy and make it do the convert.
Jacob
On 3/9/06, Robin Vickery <robinv@gmail.com> wrote:
> On 06/03/06, Jacob Friis Saxberg <webcom.dk@gmail.com> wrote:
> > > > Does anyone know of a Php funtion that can do this:
> > > >
> > > > http://golem.ph.utexas.edu/~distler/blog/NumericEntities.html
> > > Hi there!
> > >
> > > http://se.php.net/manual/en/function.htmlentities.php
> > >
> > > ?
> >
> > htmlentities converts to named entitites. I want it to numeric entities..
>
> This is probably the simplest way of doing it; write a simple function
> that translates entity names to numbers, then start an output buffer
> at the beginning of your script using the function as an output
> callback function. Then everything after that automatically gets
> converted.
>
> In fact it's so simple, I'll do it for you...
>
> Code posted to pastebin:
>
> http://robinv.pastebin.com/592400
>
> -robin
>