Skip to content

Commit

Permalink
Merge pull request #6 from Garulf/fix-encoding
Browse files Browse the repository at this point in the history
Fix: Add missing file encoding
  • Loading branch information
Garulf authored Mar 22, 2022
2 parents de81f41 + 9c918f6 commit b7f1836
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Name": "Obsidian Notes",
"Description": "Search Obsidian notes",
"Author": "Garulf",
"Version": "1.1.0",
"Version": "1.1.1",
"Language": "python",
"Website": "https://github.com/Garulf/obsidian-notes",
"IcoPath": "./icon.png",
Expand Down
8 changes: 4 additions & 4 deletions plugin/obsidian.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def get_vaults():
vaults = []
try:
with open(VAULTS_PATH, 'r') as f:
with open(VAULTS_PATH, 'r', encoding='utf-8') as f:
data = json.load(f)
except FileNotFoundError:
logger.error(f'{VAULTS_PATH} not found!\nIs obsidian installed?')
Expand All @@ -26,7 +26,7 @@ def get_vaults():

def get_vault(id):
try:
with open(VAULTS_PATH, 'r') as f:
with open(VAULTS_PATH, 'r', encoding='utf-8') as f:
data = json.load(f)
except FileNotFoundError:
logger.error(f'{VAULTS_PATH} not found!\nIs obsidian installed?')
Expand Down Expand Up @@ -82,7 +82,7 @@ def open_note(self):
open_note(self.vault.name, self.relative_path)

def content(self):
with open(self.path, 'r') as f:
with open(self.path, 'r', encoding='utf-8') as f:
return f.read()


Expand All @@ -96,7 +96,7 @@ def toggle_checkbox(self, raw):
toggled_line = line.replace(CHECK_BOX, MARKED_CHECK_BOX)
break
content = content.replace(line, toggled_line)
with open(self.path, 'w') as f:
with open(self.path, 'w', encoding='utf-8') as f:
f.write(content)

def checklists(self):
Expand Down

0 comments on commit b7f1836

Please sign in to comment.