Skip to content
Snippets Groups Projects
Commit 215a0c95 authored by Florian Obersteiner's avatar Florian Obersteiner
Browse files

explicitly use utf-8 encoding, as defined in the standard

parent 632ea2a5
No related branches found
No related tags found
1 merge request!6code refactor
......@@ -457,7 +457,7 @@ class Dataset:
return dmp
if self.inputFhandle.closed:
self.inputFhandle = open(self.inputFhandle.name)
self.inputFhandle = open(self.inputFhandle.name, encoding='utf-8')
try:
f = FilehandleWithLinecounter(self.inputFhandle, splitChar)
......@@ -663,7 +663,7 @@ class Dataset:
def readData(self, splitChar=","):
"""Read ICARTT data (from file)"""
if self.inputFhandle.closed:
self.inputFhandle = open(self.inputFhandle.name)
self.inputFhandle = open(self.inputFhandle.name, encoding='utf-8')
try:
nul = [self.inputFhandle.readline() for i in range(self.nHeaderFile)]
......@@ -906,11 +906,11 @@ class Dataset:
# read data if f is not None
if f is not None:
if isinstance(f, (str, pathlib.Path)):
self.inputFhandle = open(f, "r")
self.inputFhandle = open(f, "r", encoding='utf-8')
else:
self.inputFhandle = f
self.readHeader(splitChar)
if loadData:
self.endDefineMode()
self.readData(splitChar)
self.readData(splitChar)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment