From 2eff766e887dc4946df6bcacc55796e7d720b7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20S=C3=A1nchez=20Mu=C3=B1oz?= <esm@eduardosm.net> Date: Mon, 26 Jun 2017 12:52:50 +0200 Subject: [PATCH] Always use UTF-8 to open files in list_sources.py. This avoids problems with some locale settings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Eduardo Sánchez Muñoz <eduardosanchezmunoz@gmail.com> (github: eduardosm) --- Telegram/gyp/list_sources.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Telegram/gyp/list_sources.py b/Telegram/gyp/list_sources.py index c8fd21f63..a653846aa 100644 --- a/Telegram/gyp/list_sources.py +++ b/Telegram/gyp/list_sources.py @@ -23,6 +23,7 @@ import sys import os import re import time +import codecs def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) @@ -32,7 +33,7 @@ def check_non_empty_moc(file_path): if not os.path.isfile(file_path): return False if re.search(r'\.h$', file_path): - with open(file_path, "r") as f: + with codecs.open(file_path, mode="r", encoding="utf-8") as f: for line in f: if re.search(r'(^|\s)Q_OBJECT(\s|$)', line): return True