<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 19, 2019, 15:30 Ben Boeckel &lt;<a href="mailto:ben.boeckel@kitware.com" target="_blank" rel="noreferrer">ben.boeckel@kitware.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Aug 19, 2019 at 08:16:26 +0300, Henri Sivonen wrote:<br>
&gt; For formats that, for legacy reasons, support multiple encodings, the<br>
&gt; benefit is that iƤthe BOM unambiguously signals UTF-8. For UTF-8-only<br>
&gt; formats, the benefit of not treating the BOM as an error is to allow<br>
&gt; authoring with tools designed for the kind of formats where the BOM<br>
&gt; actually signals UTF-8 relative to other possibilities.<br>
<br>
The format specifies that it only accepts UTF-8. Within that context, is<br>
it sensible to expect implementations handle a BOM? Remember that it is<br>
mostly a format between tools and it is JSON because being able to debug<br>
it is very useful (without mandating even more code for tools to inspect<br>
yet another container format). These things should not be written by<br>
hand or edited manually, so what does one gain by allowing an encoded<br>
BOM?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Presumably the reason to use JSON instead of a custom format is to make the format consumable with JSON libraries. Therefore, it makes sense for it not to profile JSON but to work with off-the-shelf libraries. I haven&#39;t actually surveyed JSON libraries for UTF-8 BOM acceptance, but there are three reasons why UTF-8 BOM acceptance makes sense for a general-purpose JSON parsing library:</div><div dir="auto"><br></div><div dir="auto">1. Compatibility with Windows-ish text editors for those JSON formats that _are_ edited with text editors.</div><div dir="auto">2. Consistency with Web browsers.</div><div dir="auto">3. Doing the MAY from the RFC aligns with Postel&#39;s Law (which admittedly has lost quite a bit of its charm).</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>