Skip to content
Snippets Groups Projects
Unverified Commit 5b0d4f3e authored by Sanbu's avatar Sanbu Committed by GitHub
Browse files

[Fix] Set the default value of encoding in Config to utf-8 (#653)

parent 37625196
No related branches found
No related tags found
No related merge requests found
...@@ -418,7 +418,7 @@ class Config: ...@@ -418,7 +418,7 @@ class Config:
base_cfg_dict.update(_cfg_dict) base_cfg_dict.update(_cfg_dict)
if filename.endswith('.py'): if filename.endswith('.py'):
with open(temp_config_file.name) as f: with open(temp_config_file.name, encoding='utf-8') as f:
codes = ast.parse(f.read()) codes = ast.parse(f.read())
codes = RemoveAssignFromAST(BASE_KEY).visit(codes) codes = RemoveAssignFromAST(BASE_KEY).visit(codes)
codeobj = compile(codes, '', mode='exec') codeobj = compile(codes, '', mode='exec')
...@@ -550,7 +550,7 @@ class Config: ...@@ -550,7 +550,7 @@ class Config:
file_format = filename.partition('.')[-1] file_format = filename.partition('.')[-1]
if file_format == 'py': if file_format == 'py':
Config._validate_py_syntax(filename) Config._validate_py_syntax(filename)
with open(filename) as f: with open(filename, encoding='utf-8') as f:
codes = ast.parse(f.read()).body codes = ast.parse(f.read()).body
def is_base_line(c): def is_base_line(c):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment