diff --git a/python/worblehat.py b/python/worblehat.py index e030a8e..5c28f2a 100755 --- a/python/worblehat.py +++ b/python/worblehat.py @@ -14,6 +14,8 @@ import search import placement import tempfile +file_encoding = 'utf8' + def show_book_or_person(ids, commit_format=False, tmp_file=False): objects = map(get_book_or_person, ids) for i in range(len(ids)): @@ -218,8 +220,8 @@ def run_editor(filename): exit("Error: %s: File does not exist!" % filename) def write_tmpfile(pfix='', content=''): - file = tempfile.NamedTemporaryFile(prefix=pfix, dir='/tmp', delete=False) - file.write(content) + file = tempfile.NamedTemporaryFile(prefix=pfix+'-', dir='/tmp', delete=False) + file.write(content.encode(file_encoding)) name = file.name file.close() return name