Inada Naoki <songofaca...@gmail.com> added the comment:
(Off topic) There is a very common mistake in this code: ``` with oepn(filepath, 'r') as f: data = json.load(f) ``` JSON file is encoded in UTF-8. But the default text encoding is locale encoding. You should do this instead: ``` with oepn(filepath, 'rb') as f: data = json.load(f) ``` This works for legacy JSON with UTF-16 or UTF-32 (with/without BOM).too. ---------- nosy: +inada.naoki _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41284> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com