[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 1/2] qapi: open files in binary mode and use

From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v3 1/2] qapi: open files in binary mode and use explicit decoding/encoding in common.py
Date: Mon, 18 Jun 2018 07:25:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Matthias Maier <address@hidden> writes:

> This is a different approach to fix the locale dependent encode/decode
> problem in common.py utilizing the binary read/write mode [1,2], and (if
> a python 3 interpreter is used) with explicit decode/encode arguments
> [3].

Why can't we simply pass encoding='utf-8' to open()?

> This approach is preferred over the fix in commit d4e5ec877ca because it
> is (a) locale independent, and (b) does not depend on the en_US.UTF_8
> locale to be available.
> [1] https://docs.python.org/3.6/library/stdtypes.html#bytes.decode
> [2] https://docs.python.org/3.6/library/stdtypes.html#str.encode
> [3] https://docs.python.org/3/howto/unicode.html
> Signed-off-by: Arfrever Frehtes Taifersar Arahesis <address@hidden>
> Signed-off-by: Matthias Maier <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]