Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #8737
| Path | csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | "Peter H. Coffin" <hellsop@ninehells.com> |
| Newsgroups | comp.lang.php |
| Subject | Re: Thorny string translation issue. |
| Date | Tue, 19 Mar 2013 07:58:17 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 30 |
| Message-ID | <slrnkkgo79.m9f.hellsop@nibelheim.ninehells.com> (permalink) |
| References | <ki87ne$s68$1@news.albasani.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | mx05.eternal-september.org; posting-host="4163d0103afdb3d32fe6c98974b1e330"; logging-data="10915"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+b5gJLBlOVrxcPKYGflsh3" |
| User-Agent | slrn/0.9.9p1 (OpenBSD) |
| Cancel-Lock | sha1:8s7aR+TjuIT632w4n5ZP0cqGI5U= |
| Xref | csiph.com comp.lang.php:8737 |
Show key headers only | View raw
On Mon, 18 Mar 2013 23:24:31 +0000, The Natural Philosopher wrote:
>
>
> The problem.
>
> 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.
>
> Anyone done this before?
Sorry to say, either it's HTML or it's not and bare anglebraces are
not HTML. There's no way to reliably tokenize only some angles without
serious context analysis, and even a reasonably complex regular
expression isn't going to be able to get EVERYTHING right. Your only
path that I see is to load a DTD and essentially pre-render the document
in memory to handle the real tags, convert everthing that's left to
entities, and then compare/build the two copies, taking the tags from
the raw file and the entities from the rendered-and-converted one. And
even that could screw things up at least differently from some other
means of rendering things, so results could vary.
--
Surely the 98% of DNA we share with monkeys must be enough to stop
people from sinking this low.
-- Frossie
Back to comp.lang.php | Previous | Next — Previous 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