String with carriage returns causes problems

I am trying to display a String by default into a text area using a JSP directive and it works unless there is a carriage return contained in the String that is returned.

What I am looking for is what character will represent the carriage return to do a substring and break it up into multiple javascript assignments.

For instance:

Now there is:

document.getElementById('coverRow2').innerHTML = "<textarea cols='40' rows='10' name='coverPageContent' id='coverPageContent' onKeyUp='setScreenState(true); wrap'><%=faxCoverBLOB.getCompressedBlobString() %></textarea>";

I think I would need to go with
javascriptString += substring(faxCoverBLOB.getCompressedBlobString(), 0, indexOf('character')) or something like that, but I don't know which character I should search for.
neverrealmAsked:
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.

siliconeagleCommented:
you will also have problems with quotes("):-
faxCoverBLOB.getCompressedBlobString().relpace("\n","\\n").relpace("\"","\\"");
0
siliconeagleCommented:
actually
faxCoverBLOB.getCompressedBlobString().relpaceAll("\n","\\n").relpaceAll("\"","\\"");
0
neverrealmAuthor Commented:
That's a great idea, but it didn't work.  Also my IDE won't compile the page with the replaceAll("\"", "\\"") portion.  I still get an unterminated string constant with this.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

neverrealmAuthor Commented:
Well, I had to bite the bullet and include the textarea in the main source of the html.  Does anyone have a good way of handling an unchecked checkbox submit?
0
siliconeagleCommented:
sorry should be :-
faxCoverBLOB.getCompressedBlobString().relpaceAll("\n","\\\n").relpaceAll("\"","\\\"");
0

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
siliconeagleCommented:
if you have a boolean value for your checkbox:-
<% boolean chkBoxVal=(request.getParameter("chkBoxParam")!=null)?true:false;%>
0
neverrealmAuthor Commented:
Actually, I figured it out already, but gave you the answer.  I have a javascript method that actually does the submitting and I can pass additional request paramaters to it and have used that.

Thanks anyhow.  The replaceAll function may come in handy later.
0
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
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.