Escaping plus symbol (+) in textarea

I have a form with a textarea that is outputting data from my database, when a (+) symbol is entered in the form and submitted like "C++" it gets saved in the database correctly but displays "C  " without the (+) symbols. I believe it is getting taken out of the page via javascript and have tried the code below but it doesn't work.
	objParams[ strKey ] 
	// Escape the "+" manually.
		new RegExp( "\\+", "g" ), 

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Is there any javascript running on the page that might do this?  You say it gets saved as "C++", so is the issue when you try to display the form again?
Are you checking what is being submitted with the form in your server side?
tribalboy3000Author Commented:
The form is actually a CFFORM on a Coldfusion page. I know that when CF is interpreted javascript is sometimes added to the source code. When the form is submitted ( C++) it is being stored in the database as (C++), when it is being passed back to the web page it is not displaying the (++) just (C  ) is showing.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

In that case you probably need to convert data coming out of the database into safe data before using it on the web page.
an HTML text area is designed only for basic text (letters and numbers) and no special characters.  Whether going into CF, or a form submit, the text area does not preserve special characters, carriage returns, line feeds, and any special formatting, including HTML.  If you want to preserver these, you use the RICH text area, which is a simple plug in to any web page -- try it, you will likely find it works fine --
tribalboy3000Author Commented:
Im using Rich Text in my CFForm, the problem I found is that the textarea is being passed thru the url and the (+) symbol is being replaced by a blank space.
How is the textarea being populated?  You say "thru the url", but that doesn't make sense to me.

A plus symbol is not a special character to a textarea, but it is to a URL (the plus symbol is a space), I just don't understand your process of getting the value out of the database and into the textarea.
tribalboy3000Author Commented:
I figured it out! the form "value" was being passed thur a url and the (+) symbol when being used in the textform was not going thru. Example (C+ or C++). I had to use a replace to change out the (+) to (%2B) which is the html format for (+).
<a href="frm_InsertCurMod.cfm?COURSETITLE=#Trim(COURSETITLE)#&FORMVALUE=
#Replace(Replace(COURSE_DESCR,"++","%2B%2B"), "+", "%2B")#&ACAD_PLAN=#ACAD_PLAN#"> Edit Course Description</a>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.