Properly parsing carriage returns in Rails so javascript doesn't freak out

I've got some code that "quotes" the contents of a blog post and inserts it into a comment box wrapped in a blockquote. You can view it here:

Problem is, every time I try to quote a block of text with more than one line in it, the javascript freaks out. Can anyone tell me how I should be parsing these line breaks properly? thanks!


I just call the escape function (js) and it works fine e.g.

                <%= link_to_remote "Try it!",:url => { :action => :test_rule },                    :with => "'code='+escape(rule_rule_body.value) +'&input_data='+escape(input_data.value) +'&business_type='+escape(rule_business_type.value)" %>

which passes a block of text for evaluation to the server.