From 3a9e785029baa2a8ec52b8a69148761707d75057 Mon Sep 17 00:00:00 2001 From: Ghraven Date: Tue, 26 May 2026 09:27:48 +0800 Subject: [PATCH] fix: use utf-8 for local tracking text files --- burr/tracking/server/backend.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/burr/tracking/server/backend.py b/burr/tracking/server/backend.py index 1e1c27d3a..0dafd88f5 100644 --- a/burr/tracking/server/backend.py +++ b/burr/tracking/server/backend.py @@ -309,7 +309,7 @@ async def _load_project_annotations(self, project_id: str): annotations_path = self._get_annotation_path(project_id) annotations = [] if os.path.exists(annotations_path): - async with aiofiles.open(annotations_path) as f: + async with aiofiles.open(annotations_path, encoding="utf-8") as f: for line in await f.readlines(): annotations.append(AnnotationOut.parse_raw(line)) return annotations @@ -348,7 +348,7 @@ async def create_annotation( **annotation.dict(), ) annotations_path = self._get_annotation_path(project_id) - async with aiofiles.open(annotations_path, "a") as f: + async with aiofiles.open(annotations_path, "a", encoding="utf-8") as f: await f.write(annotation_out.json() + "\n") return annotation_out @@ -381,7 +381,7 @@ async def update_annotation( detail=f"Annotation: {annotation_id} from project: {project_id} not found", ) annotations_path = self._get_annotation_path(project_id) - async with aiofiles.open(annotations_path, "w") as f: + async with aiofiles.open(annotations_path, "w", encoding="utf-8") as f: for a in all_annotations: await f.write(a.json() + "\n") return annotation_out @@ -407,7 +407,7 @@ async def get_annotations( if not os.path.exists(annotation_path): return [] annotations = [] - async with aiofiles.open(annotation_path) as f: + async with aiofiles.open(annotation_path, encoding="utf-8") as f: for line in await f.readlines(): parsed = AnnotationOut.parse_raw(line) if ( @@ -530,7 +530,7 @@ async def get_application_logs( steps = Step.from_logs(lines) children = [] if os.path.exists(children_file): - async with aiofiles.open(children_file) as f: + async with aiofiles.open(children_file, encoding="utf-8") as f: str_children = await f.readlines() children = [ ChildApplicationModel.parse_obj(json.loads(item)) for item in str_children