Rails escape_javascript creates invalid JSON with single quotes
Posted
by Arrel
on Stack Overflow
See other posts from Stack Overflow
or by Arrel
Published on 2010-04-26T18:48:14Z
Indexed on
2010/04/26
18:53 UTC
Read the original article
Hit count: 148
The escape_javascript method in ActionView escapes the apostrophe '
as backslash apostrophe \'
, which gives errors when parsing as JSON.
Is there a patch to fix this, or an alternate way to escape strings when printing to JSON?
© Stack Overflow or respective owner