On Wednesday 29 November 2006 16:28, Rick Root wrote:
> > I didn't see the start of the thread, so this may have been addressed -
> > but why are you letting your users enter HTML ?
> That's not the sole purpose. In fact, I'm trying to "sanitize" HTML
> emails being viewed in a webmail application.
Ahh.
Most HTML emails contain a plain text part, as I'm sure you know, but a good
start with HTML only emails might be:
Repeat until no matches:
For each <(.*)>(.*)</$1> replace with $2
For each <(.*)/> except <p/> replace with empty string
For each <br> replace with \n
For each <p> or <p/> replace with \n\n
For each <(.*)> replace with escape(<)$1escape(>)
If you know non-CF langauges, look at a webmail app written (SquirrelMail
springs to mind) in them and see what they do - this isn't the first or last
time someone's had to do this :-)
> Just FYI, that doesn't work because even if you disable the ability to
> edit source directly, users can still paste in undesirable stuff. Not
But the editor will escape it when it's inserted, so all the angle
brackets 'vanish'.
tinyMCE, for instance also supports doing all sorts of cleaver things when
content is pasted.
--
Tom Chiverton
Helping to synergistically embrace robust schemas
****************************************************
This email is sent for and on behalf of Halliwells LLP.
Halliwells LLP is a limited liability partnership registered in England and
Wales under registered number OC307980 whose registered office address is at St
James's Court Brown Street Manchester M2 2JF. A list of members is available
for inspection at the registered office. Any reference to a partner in relation
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law
Society.
CONFIDENTIALITY
This email is intended only for the use of the addressee named above and may be
confidential or legally privileged. If you are not the addressee you must not
read it and must not use any information contained in nor copy it nor inform
any person other than Halliwells LLP or the addressee of its existence or
contents. If you have received this email in error please delete it and notify
Halliwells LLP IT Department on 0870 365 8008.
For more information about Halliwells LLP visit www.halliwells.com.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262051
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4