Skip to content

Commit

Permalink
Fix Unicode encoding failure in directory export when creating filena…
Browse files Browse the repository at this point in the history
…mes from journal titles with certain characters (#1090)

Fix Unicode encoding failure in directory export when creating filenames from journal titles with certain characters
  • Loading branch information
micahellison committed Nov 21, 2020
1 parent 046ebc7 commit b511461
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions features/format.feature
Expand Up @@ -536,3 +536,21 @@ Feature: Custom formats
[2013-06-10 15:40] Life is good.
But I'm better.
"""

Scenario Outline: Exporting entries with Cyrillic characters to directory should not fail
Given we use the config "<config>.yaml"
And we use the password "test" if prompted
And we create a cache directory
When we run "jrnl 2020-11-21: Первая"
When we run "jrnl --format md --file {cache_dir} -on 2020-11-21"
Then the cache should contain the files
"""
2020-11-21_первая.md
"""

Examples: configs
| config |
| basic_onefile |
| basic_encrypted |
| basic_folder |
| basic_dayone |
4 changes: 2 additions & 2 deletions jrnl/plugins/text_exporter.py
Expand Up @@ -37,8 +37,8 @@ def write_file(cls, journal, path):

@classmethod
def make_filename(cls, entry):
return entry.date.strftime(
"%Y-%m-%d_{}.{}".format(cls._slugify(str(entry.title)), cls.extension)
return entry.date.strftime("%Y-%m-%d") + "_{}.{}".format(
cls._slugify(str(entry.title)), cls.extension
)

@classmethod
Expand Down

0 comments on commit b511461

Please sign in to comment.