Use the infinately more correct toSource() method rather than the horrible hand-rolled escape_quotes() function.