Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #8731
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Thorny string translation issue. |
| Date | 2013-03-19 09:33 +0000 |
| Organization | albasani.net |
| Message-ID | <ki9bcd$gu7$1@news.albasani.net> (permalink) |
| References | <ki87ne$s68$1@news.albasani.net> <ki8bbd$rrk$1@speranza.aioe.org> |
On 19/03/13 00:26, Christoph Becker wrote: > The Natural Philosopher wrote: > >> I want the user to enter raw text and embedded HTML into a database. No >> trouble with getting it in, but when getting it out, it needs massaging >> for display.. >> >> Now I cant find a function in the library that will skip html styles >> like <b>...</b> or <a...></a> code, and yet still tranlsatee e.g. '>' to >> '>' etc etc. > > You can strip the tags with strip_tags() (note the $allowable_tags > parameter) and later escape the HTML special characters with > htmlspecialchars() (note the $encoding parameter, which may be necessary > to prevent UTF-7 injection attacks). Simplified: how do I put the tags I want back though. Specifically consider the example <b> <= </b> where I want to display a bold 'arrow' strip tags will just remove the tags I want. But htmlspecialchars simply turns all tags into (displayed ) raw html. > > >>> $str='alpha <b>beta < gamma</b> delta'; > >>> htmlspecialchars(strip_tags($str)); > 'alpha beta < gamma delta' > yes, but that's not the output I want. -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Thorny string translation issue. The Natural Philosopher <tnp@invalid.invalid> - 2013-03-18 23:24 +0000
Re: Thorny string translation issue. Christoph Becker <cmbecker69@gmx.de> - 2013-03-19 01:26 +0100
Re: Thorny string translation issue. The Natural Philosopher <tnp@invalid.invalid> - 2013-03-19 09:33 +0000
Re: Thorny string translation issue. BootNic <bootnic.bounce@gmail.com> - 2013-03-19 07:45 -0400
Re: Thorny string translation issue. Christoph Becker <cmbecker69@gmx.de> - 2013-03-20 00:56 +0100
Re: Thorny string translation issue. SwissCheese <swisscheese@cfl.rr.com> - 2013-03-18 20:40 -0400
Re: Thorny string translation issue. The Natural Philosopher <tnp@invalid.invalid> - 2013-03-19 09:38 +0000
Re: Thorny string translation issue. Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-19 09:01 -0400
Re: Thorny string translation issue. "Peter H. Coffin" <hellsop@ninehells.com> - 2013-03-19 07:58 -0500
csiph-web