<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 8/19/19 4:52 PM, Tony V E wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAOHCbis53nxB4hyjWmO0p5Ny=n11M25zAqiYqMWPaUV0XnBf4Q@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div><a
            href="https://en.wikipedia.org/wiki/Byte_order_mark#Usage"
            moz-do-not-send="true">https://en.wikipedia.org/wiki/Byte_order_mark#Usage</a></div>
        <div><br>
        </div>
        <div>There is some pertinent advice on that page.</div>
      </div>
    </blockquote>
    <p>Indeed, some of which would benefit from a citation :)</p>
    <p>Tom.<br>
    </p>
    <blockquote type="cite"
cite="mid:CAOHCbis53nxB4hyjWmO0p5Ny=n11M25zAqiYqMWPaUV0XnBf4Q@mail.gmail.com">
      <div dir="ltr">
        <div>There is also a note that Visual Studio uses/used the BOM
          to see if a file is UTF8 vs whatever else.</div>
        <br>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Mon, Aug 19, 2019 at 3:46
          PM Ben Boeckel &lt;<a href="mailto:ben.boeckel@kitware.com"
            moz-do-not-send="true">ben.boeckel@kitware.com</a>&gt;
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On
          Mon, Aug 19, 2019 at 22:25:05 +0300, Henri Sivonen wrote:<br>
          &gt; On Mon, Aug 19, 2019 at 9:57 PM Ben Boeckel &lt;<a
            href="mailto:ben.boeckel@kitware.com" target="_blank"
            moz-do-not-send="true">ben.boeckel@kitware.com</a>&gt;
          wrote:<br>
          &gt; &gt; Notepad?<br>
          &gt; <br>
          &gt; Yes, Notepad. It's generally easier to make parsers of
          all kinds (XML<br>
          &gt; before, JSON later) accept the UTF-8 BOM than to fight
          Notepad. It'll<br>
          &gt; take a long time for the existing installed base to get
          replaced with<br>
          &gt; the newest: <a
            href="https://mobile.twitter.com/JenMsft/status/1163474010509701120"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://mobile.twitter.com/JenMsft/status/1163474010509701120</a><br>
          <br>
          BOMs only make sense in an at-rest storage backed JSON file
          that the<br>
          parser reads directly. Given a string, a JSON parser should
          *certainly*<br>
          not accept a BOM leader.<br>
          <br>
          Quick survey:<br>
          <br>
              % echo $'\xEF\xBB\xBF{}' &gt; bom.json<br>
          <br>
            - jsoncpp: no mention of a BOM in the source, probably
          unhappy about<br>
              it<br>
            - jq: fine<br>
            - python3:<br>
              json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode
          using utf-8-sig): line 1 column 1 (char 0)<br>
            - ruby:<br>
              /usr/share/ruby/json/common.rb:156:in `parse': 765:
          unexpected token at '\xEF\xBB\xBF{}' (JSON::ParserError)<br>
            - C#: <a
            href="https://jimmybogard.com/the-curious-case-of-the-json-bom/"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://jimmybogard.com/the-curious-case-of-the-json-bom/</a><br>
          <br>
          I don't know that BOM support is actually all that wide-spread
          in<br>
          readers based on this short survey. And the solution seems to
          be "don't<br>
          write the BOM" where the problem is encountered.<br>
          <br>
          I think those sticking to their notepad guns are just going to
          have to<br>
          wait for something better because waiting for the libraries to
          catch up<br>
          (and the relevant fixes to be backported to declared minimum
          supported<br>
          versions) is likely going to take *even longer*. Or they can
          download a<br>
          real editor and actually contribute to whatever codebase
          they're trying<br>
          to build.<br>
          <br>
          &gt; &gt; &gt; 2. Consistency with Web browsers.<br>
          &gt; &gt;<br>
          &gt; &gt; I don't see why a web browser would care about these
          files.<br>
          &gt; <br>
          &gt; Maybe not _these_ JSON files, but a general-purpose JSON
          parser can<br>
          &gt; still care about consistency with Web browsers.<br>
          <br>
          That's fine. They can then accept the not-BOM files that every
          writer<br>
          for this format would write just like every other BOM-less<br>
          network-transferred JSON content in the world.<br>
          <br>
          --Ben<br>
        </blockquote>
      </div>
      <br clear="all">
      <br>
      -- <br>
      <div dir="ltr" class="gmail_signature">
        <div dir="ltr">
          <div>Be seeing you,<br>
          </div>
          Tony<br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
SG16 Unicode mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Unicode@isocpp.open-std.org">Unicode@isocpp.open-std.org</a>
<a class="moz-txt-link-freetext" href="http://www.open-std.org/mailman/listinfo/unicode">http://www.open-std.org/mailman/listinfo/unicode</a>
</pre>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>