Skip to content

Handle various patch file encodings

Major Hayden requested to merge github/fork/major/read-as-utf8 into master

Patches are in all kinds of encodings, like cp1252, iso-8859-1, and utf-8. Detecting them and reacting with decoding is really challenging and leads to failures fairly regularly.

This patch aims to read in all patches as ASCII and use the surrogateescape error handler to work around any peculiar characters. This recommendation came from:

http://python-notes.curiousefficiency.org/en/latest/python3/text_file_processing.html

It's been tested with all of the existing patches in the Linux stable queue and it seems to work fine.

Signed-off-by: Major Hayden major@redhat.com

Merge request reports