in reply to Re: Rogue character(s) at start of JSON file (BOM; dumping references)
in thread Rogue character(s) at start of JSON file

«…they could have a meaning…»

I'm not so sure about that anymore. At least in this case. More or less by accident I stumbled across this. For convenience the link to the RCF. Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

  • Comment on Re^2: Rogue character(s) at start of JSON file (BOM; dumping references)

Replies are listed 'Best First'.
Re^3: Rogue character(s) at start of JSON file (BOM only at start)
by LanX (Saint) on Jan 20, 2023 at 14:09 UTC
    > > …they could have a meaning…

    > I'm not so sure about that anymore.

    Simpl(-istic) example, imagine a data-structure

    %unicode = ( ..., "BOM" => "\x{FEFF}", ... )

    and transfer it as JSON.

    Removing all "\x{FEFF}" would wreck the data.

    While a BOM at the strings start is illegal JSON, it's not uncommon.

    So removing just a leading BOM, before trying to convert the JSON, is safe.

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery