On 03Sep2019 03:59, Hongyi Zhao <hongyi.z...@gmail.com> wrote:
On Tue, 03 Sep 2019 08:24:17 +1000, Cameron Simpson wrote:
Finally, the .decode('utf8') assumes your locale is UTF8 based. It
probably is, but if it isn't then you may get mojibake.

Nowadays, most of the os use utf8 as the default locale.  Am I wrong?

You are not wrong. So it is pretty safe to do what you did.

It was merely that it is hardwired in your code (and you need to wire in something). Just keep in mind that _if_ this script runs in a non-utf8 environment the decoding may be wrong. Unlikely to actually happen though.

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to