Don't ask to ask, just ask | |
PerlMonks |
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 ( [id://11149727]=note: print w/replies, xml ) | Need Help?? |
> > …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
In Section
Seekers of Perl Wisdom
|
|