From 91fe0a9789d1b114e3b5dccc2516d32fc694a0b1 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 16 Jan 2020 12:10:01 +0100 Subject: [PATCH] Fixed read iso-8859-1 files Signed-off-by: Dimitris Zlatanidis --- slpkg/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/slpkg/utils.py b/slpkg/utils.py index b3be5dd2..b2c5c98a 100644 --- a/slpkg/utils.py +++ b/slpkg/utils.py @@ -59,9 +59,11 @@ class Utils: def read_file(self, registry): """Returns reading file """ - with open(registry, "r") as file_txt: + code = self.check_encoding('', registry) + if not code: + code = "utf-8" + with open(registry, "r", encoding=code) as file_txt: read_file = file_txt.read() - file_txt.close() return read_file def package_name(self, PACKAGES_TXT):