Skip to content
Snippets Groups Projects
Simon Ser's avatar
Simon Ser authored
Python's open() function will return a file object that decodes input
bytes to an UTF-8 string. Python assumes all files are UTF-8 by default
(unless an explicit encoding param is passed).

This works fine with 7-bit and UTF-8 messages. However, when a message
uses a 8-bit Content-Transfer-Encoding and a non-UTF-8 charset (such as
iso-8859-1), Python will error out.

To prevent this, open the file in binary mode to prevent Python from
doing any charset conversion under-the-hood.

Signed-off-by: Simon Ser's avatarSimon Ser <contact@emersion.fr>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
d79c5784
History

DRM Maintainer Tools

This project covers the tools and documentation for maintaining, committing, and contributing to the Linux kernel DRM subsystem's drm-misc and drm-intel repositories. The intended audience is primarily the maintainers and committers of said repositories, but the workflow documentation may be useful for anyone interested in the kernel graphics subsystem development.

Please see the DRM Maintainer Tools Documentation for more information, and contributing and contact on how to collaborate on the documentation and tools.