Skip to main content
October 8, 2009
Question

cftextarea HELP!!

  • October 8, 2009
  • 1 reply
  • 692 views

Hi,

I am using CF8's cftextarea & rich text editor to accept some data from users. To save it in my MySQL database I use HTMLEditFormat() to escape the special characters.  This works fine - the text is saved as a string with all special chars escaped.

The question is - when I read that data from the database to display it on a web page it just displays it as a string - not html formatted text.

An example would be:

  1. A users type in the words "Sample Text" with font colour red.
  2. Its stored in my database as:

    <p><span style="color: rgb(255, 0, 0);">Sample Text</span></p>

  3. When I output to my web page in cfoutput tags its displays it as a string (including the tags) - not as "Sample Text" in red type

Is there a simple way to unescape the chars or do I need to use Replace()......or is there a better way to do this?

Thanks.

Aaron

This topic has been closed for replies.

1 reply

Inspiring
October 19, 2009

G'day

Why are you escaping it in the first place?  MySQL doesn't see mark-up as "special characters" so there's no need to escape them.  It's all just text to a DB.  The browser is the only thing that cares whether it's mark-up or not.

--

Adam