diff options
author | Manuel Ebert <manuel@1450.me> | 2014-05-19 14:47:44 -0700 |
---|---|---|
committer | Manuel Ebert <manuel@1450.me> | 2014-05-19 14:47:44 -0700 |
commit | 0961aa7610164c5c16cf64dab8102b6d3510a659 (patch) | |
tree | 56a34937f2bc92a1d4c6fff491f1f978012377d4 | |
parent | cd96b37ec7e3dfae189c9a0accb156ab980bd77e (diff) | |
parent | 05febbf9f65b8f05b30f85186c83341deb210439 (diff) |
Merge pull request #163 from maebert/fix-162
Fix 162
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | jrnl/__init__.py | 2 | ||||
-rw-r--r-- | jrnl/exporters.py | 5 |
3 files changed, 5 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 14b634d9..2eb1a0be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Changelog ### 1.7 (December 22, 2013) +* __1.7.22__ Fixed an issue with writing files when exporting entries containing non-ascii characters. * __1.7.21__ jrnl now uses PKCS#7 padding. * __1.7.20__ Minor fixes when parsing DayOne journals * __1.7.19__ Creates full path to journal during installation if it doesn't exist yet diff --git a/jrnl/__init__.py b/jrnl/__init__.py index eef08dc0..1e1dc0ec 100644 --- a/jrnl/__init__.py +++ b/jrnl/__init__.py @@ -8,7 +8,7 @@ jrnl is a simple journal application for your command line. from __future__ import absolute_import __title__ = 'jrnl' -__version__ = '1.7.21' +__version__ = '1.7.22' __author__ = 'Manuel Ebert' __license__ = 'MIT License' __copyright__ = 'Copyright 2013 - 2014 Manuel Ebert' diff --git a/jrnl/exporters.py b/jrnl/exporters.py index b8463e03..83499f87 100644 --- a/jrnl/exporters.py +++ b/jrnl/exporters.py @@ -5,6 +5,7 @@ from __future__ import absolute_import import os import json from .util import u, slugify +import codecs def get_tags_count(journal): @@ -81,7 +82,7 @@ def export(journal, format, output=None): content = maps[format](journal) if output: try: - with open(output, 'w') as f: + with codecs.open(output, "w", "utf-8") as f: f.write(content) return "[Journal exported to {0}]".format(output) except IOError as e: @@ -101,6 +102,6 @@ def write_files(journal, path, format): content = e.to_md() elif format == 'txt': content = u(e) - with open(full_path, 'w') as f: + with codecs.open(full_path, "w", "utf-8") as f: f.write(content) return "[Journal exported individual files in {0}]".format(path) |