Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Unicode encoding failure in directory export when creating filenames from journal titles with certain characters #1090

Merged
merged 5 commits into from Nov 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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