On Sun, Sep 13, 2020 at 8:59 AM Christopher Barker <pythonchb@gmail.com> wrote:
On Sun, Sep 13, 2020 at 7:58 AM Stephen J. Turnbull <turnbull.stephen.fw@u.tsukuba.ac.jp> wrote:
 > encoding=None: this is the important one -- json is always UTF-8 yes?

Standard JSON is always UTF-8.  Nevertheless, I'm quite sure that
there's a ton of Japanese in Shift JIS, including some produced by
default in Python on Windows.  I'll bet the same is true of GBK for
Chinese, and maybe even ISO-8859-1 in Europe.

If a document is not encoded as UTF-8, then it is not JSON.  It might be "a format closely inspired by JSON" but not the real thing.

I think it's reasonable for a new json.loadf() function to only handle actual JSON files.  If something is encoded wrongly, user can do what they do now, and use the various options to open() combined with json.load() or json.loads().  A good error message about the encoding being the issue would be nice.
 

--
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.