<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div><span>"</span><span style="font-family: monospace; font-size: 10pt;">What about a JSON-encoded string containing "</script>", should that be avoided by Erlang’s builtin parser? What about "]]>"? What about the two characters that are accepted in JSON but not in JavaScript"</span></div><div style="color: rgb(0, 0, 0); font-size: 10pt; font-family: monospace; background-color: transparent; font-style: normal;"><span style="font-family: monospace; font-size: 10pt;"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: monospace; background-color: transparent; font-style: normal;"><span style="background-color: transparent;">To what extent are these issues problematic in an Erlang environment? </span></div><div style="color: rgb(0, 0, 0); font-size:
 13px; font-family: monospace; background-color: transparent; font-style: normal;"><span style="background-color: transparent;"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: monospace; background-color: transparent; font-style: normal;"><span style="background-color: transparent;">My proposal: support an optional plugin API for sanitizing strings, and provide a standard plugin that detects these cases.</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: monospace; background-color: transparent; font-style: normal;"><span style="background-color: transparent;"><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: monospace; background-color: transparent; font-style: normal;"><span style="background-color: transparent;">Best,</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: monospace; background-color: transparent; font-style: normal;"><span
 style="background-color: transparent;">Thomas</span></div><div class="yahoo_quoted" style="display: block;"> <br> <br> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On Sunday, March 9, 2014 6:05 PM, Anthony Ramine <n.oxyde@gmail.com> wrote:<br> </font> </div> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div class="y_msg_container">What about the utter lack of proper specifications around JSON? The fact that you always have to think about where the JSON will be injected?<br clear="none"><br clear="none">What about a JSON-encoded string containing "</script>", should that be avoided by Erlang’s builtin parser? What about
 "]]>"? What about the two characters that are accepted in JSON but not in JavaScript?<br clear="none"><br clear="none">Just because other languages include such a thing doesn’t mean Erlang should too. If diversity is not a reason to reject it, other languages providing it is not a reason to include it either.<br clear="none"><br clear="none">-- <br clear="none">Anthony Ramine<br clear="none"><br clear="none">Le 9 mars 2014 à 15:56, liuyanghejerry <<a shape="rect" ymailto="mailto:liuyanghejerry@126.com" href="mailto:liuyanghejerry@126.com">liuyanghejerry@126.com</a>> a écrit :<br clear="none"><br clear="none">> 于 2014/3/8 22:01, Anthony Ramine 写道:<br clear="none">>> The problem is not about what is accepted, it’s about how one’s (un)parser works. Sometimes you want a streaming-like API, sometimes the whole tree, etc. The Postel principle is orthogonal here.<br clear="none">>> <br clear="none">> <br
 clear="none">> So, all languages with JSON module in their standard library seems unbelievable? Because people need different parsers, so we give them no parser? I don't think this is a reason for rejecting it.<br clear="none">> <br clear="none">> _______________________________________________<br clear="none">> erlang-questions mailing list<br clear="none">> <a shape="rect" ymailto="mailto:erlang-questions@erlang.org" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none">> <a shape="rect" href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><div class="yqt8187637916" id="yqtfd39930"><br clear="none"><br clear="none">_______________________________________________<br clear="none">erlang-questions mailing list<br clear="none"><a shape="rect" ymailto="mailto:erlang-questions@erlang.org"
 href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none"><a shape="rect" href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br clear="none"></div><br><br></div> </blockquote>  </div> </div>   </div> </div></body></html>