From 7c9de8aa0e3c67ddc5afbf2f02529340b982a617 Mon Sep 17 00:00:00 2001 From: baoj2010 Date: Sun, 5 Dec 2021 16:59:23 +0800 Subject: [PATCH] Fix the bug of open exception happens when the default encoding is gbk in system --- cli/biz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/biz.py b/cli/biz.py index 71ad579..9ec3974 100644 --- a/cli/biz.py +++ b/cli/biz.py @@ -42,7 +42,7 @@ def compile_client_file(proto_path: Path, service_name: str): # 按照项目约定,一个 proto 文件中只有一个 service service, methods = None, [] - with proto_path.open() as f: + with proto_path.open(encoding='utf-8') as f: for i in f.readlines(): _service = service_pattern.match(i) _rpc = rpc_pattern.match(i)