I've noticed that SFDC is not properly escaping some characters in the code it generates to be eval'd when using javascript custom buttons. For instance, say I have an object with a field that contains a line break. My code would look like:
var field = "{!Object__c.Field}";
The code SFDC generates would look like:
eval('var field = \"Field\r\nData\"');
This is invalid javascript and will return an error. However, if SFDC properly escaped the carriage return and linefeed characters, this code would behave as expected. Is there any way to fix this behavior?