This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients kadler, methane
Date 2020-10-08.05:09:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602133763.52.0.288193776657.issue41894@roundup.psfhosted.org>
In-reply-to
Content
> I have since changed the PR to use PyUnicode_DecodeFSDefault based on review feedback. I was going to say that you will have to fight it out with @methane on GH, but I see that that's you. :D Would have been nice if you would have left the updated feedback there as well so people who aren't familiar would know it's one person adjusting their recommendation vs two different people with conflicting recommendations.

OK, I changd my b.p.o username.


> The only issue I see with using backslashreplace is that users of non-UTF-8 locales would see message text that contains non-ASCII characters only as escape codes. eg, the message above would show "Il modulo dipendente libbz2.so non \xe8 stato caricato." instead of "Il modulo dipendente libbz2.so non è stato caricato."

The issue is not caused by backslashreplace, but by UTF-8 instead of locale. I notice it of course, but:

* Using UTF-8 is status quo. UTF-8:backslashreplace is the simplest fix approach.
* There is no guarantee that the error message can be decoded by locale encoding. Backslash escape is much better than "ignore" or "surrogateescape".


> By using PyUnicode_DecodeFSDefault instead, the message should be properly decoded but any encoding errors (such as utf-8 paths, etc) would be handled by surrogateescape.
> 

There is no guranatee that the message is properly decoded with fsencoding.
And surrogateescape is for round-tripping bytes path, not for human readable.
Error message should be human readable. So backslashreplace is better than surrogateescape.

Additionally, non-UTF-8 locale is quite rare on Unix systems, and users of such systems would be able to handle backslash escaped message, because they might see such message often.
History
Date User Action Args
2020-10-08 05:09:23methanesetrecipients: + methane, kadler
2020-10-08 05:09:23methanesetmessageid: <1602133763.52.0.288193776657.issue41894@roundup.psfhosted.org>
2020-10-08 05:09:23methanelinkissue41894 messages
2020-10-08 05:09:22methanecreate