You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem is, sometimes smart quotes such as ‘’, or “” are in my user's data. These show up as illegal characters for the javascript parser (I believe they actually break the JSON parser by terminating string prematurely)...however the parsing works fine when I visit the standalone JSON api endpoint (/api/v1/venues/6.json).
My initial thought was to turn config.escape_all_output to true, however this doesn't encode those characters. Any thoughts on how best to escape these characters without adding some kind of find/replace individually for every attribute in my models. Monkeypatch ERB::Util.html_escape perhaps?
The text was updated successfully, but these errors were encountered:
Hmm, yeah I can see how that might be an issue although in properly encoded UTF-8 strings it shouldn't cause any illegal character errors. Check this out: https://github.com/yob/dumb_quotes seems to be an attempt to make fixing this issue easy. I know that the approach isn't ideal, it seems to be an encoding issue of some sort.
I'm rendering a JSON object using a RABL template right into the page (so as not to make additional requests).
Problem is, sometimes smart quotes such as ‘’, or “” are in my user's data. These show up as illegal characters for the javascript parser (I believe they actually break the JSON parser by terminating string prematurely)...however the parsing works fine when I visit the standalone JSON api endpoint (/api/v1/venues/6.json).
My initial thought was to turn config.escape_all_output to true, however this doesn't encode those characters. Any thoughts on how best to escape these characters without adding some kind of find/replace individually for every attribute in my models. Monkeypatch ERB::Util.html_escape perhaps?
The text was updated successfully, but these errors were encountered: