Re: Convert all named entities into numeric character references

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jacob Friis Saxberg wrote:

Does anyone know of a Php funtion that can do this:
http://golem.ph.utexas.edu/~distler/blog/NumericEntities.html


http://se.php.net/manual/en/function.htmlentities.php


htmlentities converts to named entitites. I want it to numeric entities.

Yes; 'tis true.  However, in looking at the manual page further, I
see at least one "user submitted" entry that looks like what you
may be desiring, not too far down the page.

Kevin Kinsey

Yes, 'tis true -- sort of.

The remaining "user submitted" entries skirt the subject, but don't provide a complete translation.

I estimate about 245 named entities (w3c approved), which can be found here:

http://www.roborg.co.uk/html_entities/

If all of those were pumped through some of those "user submitted" functions, then I think that would provide Jacob's solution.

Unfortunately, I don't know of any current php functions that do that. I'm sure you realize that they (Jacob's link above) are simply taking a small set of entities to their to their Unicode equivalents, which are in HEX.

For example a euro-glyph code point in Unicode is 20AC, which is of course HEX for 8364 DEC.

The problem is that unfortunately most browsers do not yet support Unicode characters, so one must either use "&euro" or it's decimal equivalent in the form of &#8364.

So, at the moment, we are in transition. It might be a nice and a somewhat simple project for someone to convert all named entities into numeric equivalents.

If I find some spare time (other than writing post to this list), perhaps I'll do it.

tedd

--
--------------------------------------------------------------------------------
http://sperling.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux