Skip to content

Commit ef95bfa

Browse files
authored
🐛 Fix: 修复在 Windows 平台下未使用 UTF-8 编码读取模块信息的问题 (#163)
1 parent 65e43f6 commit ef95bfa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

nb_cli/handlers/store.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ async def dump_unpublished_modules(module_class: type[T], newer: list[T]) -> Non
4949
module_name: str = module_class.__module_name__
5050

5151
if (path_current := CACHE_DIR / f"{module_name}.json").is_file():
52-
async with await anyio.open_file(path_current) as fcurrent:
52+
async with await anyio.open_file(path_current, encoding="utf-8") as fcurrent:
5353
current = type_validate_json(list[module_class], await fcurrent.read())
5454
else:
5555
current: list[T] = []
5656

5757
if (path_historical := CACHE_DIR / f"{module_name}_unpublished.json").is_file():
58-
async with await anyio.open_file(path_historical) as fhistorical:
58+
async with await anyio.open_file(
59+
path_historical, encoding="utf-8"
60+
) as fhistorical:
5961
historical = type_validate_json(
6062
list[module_class], await fhistorical.read()
6163
)

0 commit comments

Comments
 (0)