> This seems like something we should have stumbled on to
> years ago, but for
> the first time this is causing us problems.

> Am I correct in my observations that text areas render
> HTML entities?  If so
> how do you guys deal with this?

> I have a HTML newsletter email that is pasted into a text
> area and saved to
> a database. When the HTML body of the email is edited by
> reloading into a
> text area and saving it, all of the HTML entities are
> converted to "
> extended characters ".

> There must be a simple way to stop this.... anyone have
> ideas?

Yes, that's normal behavior. Although you usually don't want to store
html entities in the content in your database. What you generally want
it so convert the necessary characters into html entities when the
content is displayed in html format. If it's displayed somewhere else
(the text portion of a multi-part email, for example) then you want it
to display as unformatted text.

CORRECT FORMATTING:

input:
<textarea name="mytext">#htmleditformat(query.mytext)#</textarea>

display:
<div>#htmleditformat(query.mytext)#</div>

INCORRECT AND HAZARDOUS FORMATTING:

input:
<textarea name="mytext">#query.mytext#</textarea>

display:
<div>#query.mytext#</div>

However, if the text being input is expected in html / xhtml format
then you need to convert those entities back into entities. I've used
the wysiwyg editor from http://tinymce.moxiecode.com which I think
might resolve this for you (I'm not sure, I haven't looked for this
behavior specifically -- don't ask, but it didn't occur to me),

otherwise you would need to manually replace the necessary
characters... the problem being that you can't just use
htmleditformat() because that will eliminate any tags the user
entered. I would try parsing the tags in the input with a regular
expression (check out the cf_reextract custom tag) then use
htmleditformat() to format any attributes or text nodes that contain
those characters.


s. isaac dealey     954.522.6080
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218825
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to