X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/efafa5271957fb54b356ec1c90e8613f14de40d4..3ba975466c166e9d9eceee34189d22c1561e69c1:/nominatim/tools/special_phrases/sp_csv_loader.py diff --git a/nominatim/tools/special_phrases/sp_csv_loader.py b/nominatim/tools/special_phrases/sp_csv_loader.py index a32a4b39..55a9d8d0 100644 --- a/nominatim/tools/special_phrases/sp_csv_loader.py +++ b/nominatim/tools/special_phrases/sp_csv_loader.py @@ -39,8 +39,8 @@ class SPCsvLoader(Iterator): """ phrases = set() - with open(self.csv_path) as file: - reader = csv.DictReader(file, delimiter=',') + with open(self.csv_path, encoding='utf-8') as fd: + reader = csv.DictReader(fd, delimiter=',') for row in reader: phrases.add( SpecialPhrase(row['phrase'], row['class'], row['type'], row['operator']) @@ -54,4 +54,4 @@ class SPCsvLoader(Iterator): _, extension = os.path.splitext(self.csv_path) if extension != '.csv': - raise UsageError('The file {} is not a csv file.'.format(self.csv_path)) + raise UsageError(f'The file {self.csv_path} is not a csv file.')