Skip to content

Commit 3be98b9

Browse files
committed
🔣 #126 fix: utf-8 based char error
1 parent c83a8a7 commit 3be98b9

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

‎routes/category.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ def category(category, by="timeStamp", sort="desc"):
103103
translationFile = (
104104
f"./translations/{language}.json" # Define the path to the translation file
105105
)
106-
with open(translationFile, "r") as file: # Open the translation file in read mode
106+
with open(
107+
translationFile, "r", encoding="utf-8"
108+
) as file: # Open the translation file in read mode
107109
translations = load(file) # Load the JSON data from the file
108110

109111
sortName = (

‎routes/dashboard.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def dashboard(userName):
100100
translationFile = f"./translations/{language}.json" # Define the path to the translation file
101101

102102
with open(
103-
translationFile, "r"
103+
translationFile, "r", encoding="utf-8"
104104
) as file: # Open the translation file in read mode
105105
translations = load(file) # Load the JSON data from the file
106106

‎routes/index.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ def index(by="hot", sort="desc"):
9494
translationFile = (
9595
f"./translations/{language}.json" # Define the path to the translation file
9696
)
97-
with open(translationFile, "r") as file: # Open the translation file in read mode
97+
with open(
98+
translationFile, "r", encoding="utf-8"
99+
) as file: # Open the translation file in read mode
98100
translations = load(file) # Load the JSON data from the file
99101

100102
translations = translations["sortMenu"] # Get the translation for the sort menu

‎utils/flashMessage.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def flashMessage(
2828
case True:
2929
# If the translation file exists, open and load the JSON data
3030
with open(
31-
translationFile, "r"
31+
translationFile, "r", encoding="utf-8"
3232
) as file: # Open the translation file in read mode
3333
translations = load(file) # Load the JSON data from the file
3434
text = translations["flash"] # Return the translations as a dictionary

‎utils/translations.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def loadTranslations(language):
2323
case True:
2424
# If the translation file exists, open and load the JSON data
2525
with open(
26-
translationFile, "r"
26+
translationFile, "r", encoding="utf-8"
2727
) as file: # Open the translation file in read mode
2828
translations = load(file) # Load the JSON data from the file
2929
Log.info(

0 commit comments

Comments
 (0)