Re: [PHP] Convert all named entities into numeric character references

2006-03-09 Thread Robin Vickery
On 06/03/06, Jacob Friis Saxberg [EMAIL PROTECTED] 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


[PHP] Convert all named entities into numeric character references

2006-03-06 Thread Jacob Friis Saxberg
Does anyone know of a Php funtion that can do this:
http://golem.ph.utexas.edu/~distler/blog/NumericEntities.html


Thanks,
Jacob

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



Re: [PHP] Convert all named entities into numeric character references

2006-03-06 Thread gustav
Hi there!

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

?

Best regards
Gustav Wiberg

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


 Thanks,
 Jacob

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



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



Re: [PHP] Convert all named entities into numeric character references

2006-03-06 Thread Jacob Friis Saxberg
  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.

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



Re: [PHP] Convert all named entities into numeric character references

2006-03-06 Thread Kevin Kinsey

Jacob Friis Saxberg 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.

 



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.

HTH,

Kevin Kinsey

--
When the only tool you have is a hammer, every problem starts to look
like a nail.

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



Re: [PHP] Convert all named entities into numeric character references

2006-03-06 Thread tedd

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