Skip to content

Commit

Permalink
io: force-interpret *.metadata as UTF-8 as otherwise unopenable on fr…
Browse files Browse the repository at this point in the history
…_FR.UTF-8???

Fixes #1997
  • Loading branch information
kernc committed Feb 7, 2017
1 parent 74706f6 commit 05834f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Orange/data/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def write_table_metadata(cls, filename, data):
if isinstance(filename, str) and hasattr(data, 'attributes'):
if all(isinstance(key, str) and isinstance(value, str)
for key, value in data.attributes.items()):
with open(filename + '.metadata', 'w') as f:
with open(filename + '.metadata', 'w', encoding='utf-8') as f:
f.write("\n".join("{}: {}".format(*kv)
for kv in data.attributes.items()))
else:
Expand All @@ -392,7 +392,7 @@ def set_table_metadata(cls, filename, table):
table.attributes = pickle.load(f)
# Unpickling throws different exceptions, not just UnpickleError
except:
with open(filename + '.metadata') as f:
with open(filename + '.metadata', encoding='utf-8') as f:
table.attributes = OrderedDict(
(k.strip(), v.strip())
for k, v in (line.split(":", 1)
Expand Down

0 comments on commit 05834f3

Please sign in to comment.