Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-28 Thread Yasuo Ohgaki
Wez Furlong wrote: > Well, if the general opinion is that there *should* be such a > function included in PHP, around a week or so ago I implemented > a version that uses the multiple charset aware tables that are > already in html.c. > > But the voting was -0 (Derick) and +1 (Yasuo). > Personall

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-28 Thread Wez Furlong
Well, if the general opinion is that there *should* be such a function included in PHP, around a week or so ago I implemented a version that uses the multiple charset aware tables that are already in html.c. But the voting was -0 (Derick) and +1 (Yasuo). Personally, I'm +0 since I have written th

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-27 Thread Markus Fischer
On Wed, Feb 27, 2002 at 11:07:29AM +0100, Derick Rethans wrote : > I've to agree wtih Rasmus here, IMO it does not warrant a new function. But don't you lost focus a bit? This is not exactly a counterpart to a function. It also adds new functionality. - Markus -- PHP Development M

RE: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-27 Thread Marc Boeren
> > Yeah, but I believe both of you are _not_ agaist for having this, > > right? Having reverse order conversion function is nice when it is > > possbile to write one even if it is relatively easy to write. IMO. > > Ok, let me put it in a more blunt way then: I'm against adding > more bloat to

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-27 Thread Derick Rethans
On Wed, 27 Feb 2002, Yasuo Ohgaki wrote: > Derick Rethans wrote: > > Hello, > > > > I've to agree wtih Rasmus here, IMO it does not warrant a new function. > > > > Derick > > Yeah, but I believe both of you are _not_ agaist for having this, > right? Having reverse order conversion function is nic

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-27 Thread Yasuo Ohgaki
Derick Rethans wrote: > Hello, > > I've to agree wtih Rasmus here, IMO it does not warrant a new function. > > Derick Yeah, but I believe both of you are _not_ agaist for having this, right? Having reverse order conversion function is nice when it is possbile to write one even if it is relative

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-27 Thread Derick Rethans
Hello, I've to agree wtih Rasmus here, IMO it does not warrant a new function. Derick On Tue, 26 Feb 2002, Rasmus Lerdorf wrote: > Reversing htmlentities is trivial. I don't think it needs a special > function. > > Simply do: > > $trans = get_html_translation_table(HTML_ENTITIES); > $tra

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Brad Fisher
Here are the diffs for the unhtmlentities function. Also included is a test script for some rudimentary benchmarking. -Brad unhtmlentities_test.php Description: application/unknown-content-type-microsoft --- html.c Tue Feb 26 22:44:44 2002 +++ html.c Wed Feb 27 00:42:04 2002 @@ -1

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Brad Fisher
No, not an exact reverse, but a function which could take arbitrary input with HTML entities in it and convert that input to a normal string. The input would not neccesarily need to come from the htmlentities function. It could come from any arbitrary HTML code, including hand-coded or generate

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Rasmus Lerdorf
But then we are not talking about the reverse of htmlentities because htmlentities() would never create On Tue, 26 Feb 2002, Brad Fisher wrote: > Not as trivial as you make it seem... > > - Consider the following code: - > >$data = "This is & some text"; >$trans = get

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Andi Gutmans
At 09:37 PM 2/26/2002 -0600, Brad Fisher wrote: >I have looked at the following: > http://www.php.net/anoncvs.php > http://cvs.php.net/cvs.php > >I am rather new to CVS, so perhaps this is a stupid question... I don't see >the HEAD branch anywhere... Can I check it out through anon CVS

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Brad Fisher
Not as trivial as you make it seem... - Consider the following code: - $data = "This is & some text"; $trans = get_html_translation_table(HTML_ENTITIES); $trans = array_flip($trans); $data2 = strtr($data,$trans); echo "Original data is:\n"; echo "$data\n\n";

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Yasuo Ohgaki
Rasmus Lerdorf wrote: > Reversing htmlentities is trivial. I don't think it needs a special > function. > > Simply do: > > $trans = get_html_translation_table(HTML_ENTITIES); > $trans = array_flip($trans); > $data = strtr($data,$trans); > > -Rasmus I agree it's easy. I prefer to have i

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Rasmus Lerdorf
Reversing htmlentities is trivial. I don't think it needs a special function. Simply do: $trans = get_html_translation_table(HTML_ENTITIES); $trans = array_flip($trans); $data = strtr($data,$trans); -Rasmus On Tue, 26 Feb 2002, Brad Fisher wrote: > > I have looked at the following: >

Re: [PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Brad Fisher
I have looked at the following: http://www.php.net/anoncvs.php http://cvs.php.net/cvs.php I am rather new to CVS, so perhaps this is a stupid question... I don't see the HEAD branch anywhere... Can I check it out through anon CVS or would I need dev access? Or is this a reference to p

[PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Yasuo Ohgaki
Quick fix Brad Fisher wrote: > PHPAPI char* php_str_unhtmlentities(char *str, unsigned int *resultlen) PHPAPI char* php_str_unhtmlentities(char *str, unsigned int *resultlen TSRMLS_DC) Use memcpy instead of strcpy/strncpy. strcpy() won't work when user uses UCS-4 or like. > > /* BF 6/11/0

[PHP-DEV] Re: Counterpart to htmlentities function: unhtmlentities

2002-02-26 Thread Yasuo Ohgaki
Brad Fisher wrote: > Just another function I have found useful.. PHP has a htmlentities > function, but no unhtmlentities function to go the other direction.. (At > least not that I am aware of). So, here you go. Don't think this one > would perform nearly as quickly if it were done using rege