1- import json
21import os
2+ import json
33from tkinter import Toplevel , Text , Scrollbar , messagebox
44from matplotlib import pyplot as plt
55
@@ -18,7 +18,7 @@ def save_test_results(download_speed, upload_speed, ping, file_path="test_histor
1818
1919 # If the file exists, load the current data
2020 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 :
2222 history = json .load (file )
2323 else :
2424 history = []
@@ -27,7 +27,7 @@ def save_test_results(download_speed, upload_speed, ping, file_path="test_histor
2727 history .append (data )
2828
2929 # Save the updated file
30- with open (file_path , "w" ) as file :
30+ with open (file_path , "w" , encoding = "utf-8" ) as file :
3131 json .dump (history , file , indent = 4 )
3232
3333
@@ -37,7 +37,7 @@ def view_history(root, history_path):
3737 messagebox .showinfo ("History" , "No history available." )
3838 return
3939
40- with open (history_path , "r" ) as file :
40+ with open (history_path , "r" , encoding = "utf-8" ) as file :
4141 history = json .load (file )
4242
4343 # Create a new window to display the history
@@ -71,7 +71,7 @@ def plot_history(root, history_path):
7171 messagebox .showinfo ("History" , "No history available." )
7272 return
7373
74- with open (history_path , "r" ) as file :
74+ with open (history_path , "r" , encoding = "utf-8" ) as file :
7575 history = json .load (file )
7676
7777 # Get data for the plot
0 commit comments