* Thus wrote Gerard Samuel ([EMAIL PROTECTED]):
> CPT John W. Holmes wrote:
> 
> >From: "Eugene Lee" <[EMAIL PROTECTED]>
> >
> > 
> >
> >>On Wed, Oct 01, 2003 at 01:12:16AM -0400, Gerard Samuel wrote:
> >>:
> >>: Got a problem with htmlspecialchars being too greedy, where
> >>: for example, it converts
> >>: &foo;
> >>: to
> >>: &amp;foo;
> >>:
> >>: Yes it displays correctly in the browser for some content, but not all.
> >>: (an example is posted below)
> >>: So I came up with this example code, but not sure if there is an
> >>: easier/better way to get the correct end result.
> >>: If there is a better way, feel free to let me know.
> >>: Thanks
> >>:
> >>: Note: I dont read/speak chinese, so if its offensive please forgive me.
> >>:
> >>: ------
> >>: <?php
> >>:
> >>: $foo = '&#20013;&#25991; & http://www.foo.com/index.php?foo=1&bar=2';
> >>
> >>
> >>
> >
> >Maybe you should run html_entity_decode() on the string first, then run
> >encode again. The decode will take &#20013; and turn it into it's actual
> >character but not affect anything else. Then the recoding will turn it back
> >into &#20013; and also encode any other characters.
> >

> John, a good idea, but unfortunately, after some tests, and re-reading 
> the manual, it seems html_entity_decode(),
> only recognises "html entities".  Not ascii values of language characters.
> So Im going to push ahead with my code, and see if it breaks anything :)

hmm.. take a look at 
  http://php.net/manual/en/function.get-html-translation-table.php

That will do exactly what john suggested.

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

Curt
-- 
List Stats: http://zirzow.dyndns.org/html/mlists/php_general/

"I used to think I was indecisive, but now I'm not so sure."

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

Reply via email to