INADA Naoki added the comment: >> stderr is used to log errors. Getting a new error when trying to log >> an error is kind of annoying. > > Hm, what bad surprise/error could appear that would not appear with > backslashescape?
$ cat badfilename.py badfn = "こんにちは".encode('euc-jp').decode('utf-8', 'surrogateescape') print("bad filename:", badfn) $ PYTHONIOENCODING=utf-8:backslashreplace python3 badfilename.py bad filename: \udca4\udcb3\udca4\udcf3\udca4ˤ\udcc1\udca4\udccf $ PYTHONIOENCODING=utf-8:surrogateescape python3 badfilename.py bad filename: �����ˤ��� ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28180> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com