1
- import json
2
1
import os
2
+ import json
3
3
from tkinter import Toplevel , Text , Scrollbar , messagebox
4
4
from matplotlib import pyplot as plt
5
5
@@ -18,7 +18,7 @@ def save_test_results(download_speed, upload_speed, ping, file_path="test_histor
18
18
19
19
# If the file exists, load the current data
20
20
if os .path .exists (file_path ):
21
- with open (file_path , "r" ) as file :
21
+ with open (file_path , "r" , encoding = "utf-8" ) as file :
22
22
history = json .load (file )
23
23
else :
24
24
history = []
@@ -27,7 +27,7 @@ def save_test_results(download_speed, upload_speed, ping, file_path="test_histor
27
27
history .append (data )
28
28
29
29
# Save the updated file
30
- with open (file_path , "w" ) as file :
30
+ with open (file_path , "w" , encoding = "utf-8" ) as file :
31
31
json .dump (history , file , indent = 4 )
32
32
33
33
@@ -37,7 +37,7 @@ def view_history(root, history_path):
37
37
messagebox .showinfo ("History" , "No history available." )
38
38
return
39
39
40
- with open (history_path , "r" ) as file :
40
+ with open (history_path , "r" , encoding = "utf-8" ) as file :
41
41
history = json .load (file )
42
42
43
43
# Create a new window to display the history
@@ -71,7 +71,7 @@ def plot_history(root, history_path):
71
71
messagebox .showinfo ("History" , "No history available." )
72
72
return
73
73
74
- with open (history_path , "r" ) as file :
74
+ with open (history_path , "r" , encoding = "utf-8" ) as file :
75
75
history = json .load (file )
76
76
77
77
# Get data for the plot
0 commit comments