From eabef5cf7bd9e9d538c7d00d6a761f0ed1dea0dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Caillaut?= Date: Fri, 5 Nov 2021 14:29:47 +0100 Subject: [PATCH] add encoding parameter in load_templates --- wikiextractor/WikiExtractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wikiextractor/WikiExtractor.py b/wikiextractor/WikiExtractor.py index ff63783e..d4a00317 100755 --- a/wikiextractor/WikiExtractor.py +++ b/wikiextractor/WikiExtractor.py @@ -191,7 +191,7 @@ def open(self, filename): # 1 2 3 4 -def load_templates(file, output_file=None): +def load_templates(file, output_file=None, encoding='utf-8'): """ Load templates from :param file:. :param output_file: file where to save templates and modules. @@ -205,7 +205,7 @@ def load_templates(file, output_file=None): page = [] inText = False if output_file: - output = open(output_file, 'w') + output = open(output_file, 'w', encoding=encoding) for line in file: #line = line.decode('utf-8') if '<' not in line: # faster than doing re.search()