From 8b851679a8c7457a65fac97de8d4001aa7db84b9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 8 Jan 2020 15:25:03 +0000 Subject: [PATCH] Fix remove_lines.py script to explicitly read input as cp1252 * The output from sphinx is in cp1252 for CHM builds, which is the only place this script is used. Trying to read it as UTF-8 will fail on non-ASCII characters. --- docs/remove_lines.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/remove_lines.py b/docs/remove_lines.py index 463b9a731..cc9b0bead 100644 --- a/docs/remove_lines.py +++ b/docs/remove_lines.py @@ -7,8 +7,13 @@ # and to remove some extra newlines getting added import sys +import codecs + def remLines(delim, above, below): + WinReader = codecs.getreader('cp1252') + sys.stdin = WinReader(sys.stdin.buffer) + buff = [] line = sys.stdin.readline() while line: