-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VELTOOLS-184 #13
base: master
Are you sure you want to change the base?
VELTOOLS-184 #13
Conversation
$esc.json() escapes ", \, and /
I see in StringEscapeUtils the following comment for
Is that what we want for json? Isn't it more pertinent to just call |
That's a fair question. I suppose the lazy answer is "because escapeJson() exists". :) Comparing escapeJava() and escapeJson() shows they differ on two characters: / and \u007F. I don't pretend to know why those differences exist, and in a quick test escapeJava() works without error. But they do produce different output strings. Without knowing the reason for this, I'd hesitate to assume that the output of escapeJava() is compatible with all existing JSON consuming code. So using escapeJson() seems the safer choice. |
Well, EcmaScript is not Json. I don't know of any valid reason to escape <'> and </> in Json, so I don't mind having an |
I'm fine with a synonym too, unless some future issue is raised for compatibility. The main point is to have $esc.json() present, since the most obvious alternative of $esc.javascript() causes errors. Which is what led Maurice Perry to create VELTOOLS-184 two years ago, and why I discovered it this week. |
I think buggy libraries which ignore |
The current state of the patch is to propose |
Because that would require more code. IMO less code is always better if you can get away with it. This is adding code just for the sake of adding code. I'm not -1'ing this or anything, just complaining that it should not be necessary. |
While I totally agree with you in general about libraries ignoring RFC, I'm not sure I understand your frustration with regards to this change. This has nothing to do with any RFC. |
$esc.json() escapes ", \, and /