On Sun, Sep 13, 2020 at 8:59 AM Christopher Barker <python...@gmail.com>
wrote:

> On Sun, Sep 13, 2020 at 7:58 AM Stephen J. Turnbull <
> turnbull.stephen...@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.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/NIXMSWYMM4W4ZRNW7GQHPAAFLXHF6AG4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to