diff --git a/ipykernel/debugger.py b/ipykernel/debugger.py index 5fc760a10..e3da33ca9 100644 --- a/ipykernel/debugger.py +++ b/ipykernel/debugger.py @@ -351,7 +351,7 @@ async def dumpCell(self, message): code = message['arguments']['code'] file_name = get_file_name(code) - with open(file_name, 'w') as f: + with open(file_name, 'w', encoding='utf-8') as f: f.write(code) reply = { @@ -378,7 +378,7 @@ async def source(self, message): } source_path = message["arguments"]["source"]["path"] if os.path.isfile(source_path): - with open(source_path) as f: + with open(source_path, encoding='utf-8') as f: reply['success'] = True reply['body'] = { 'content': f.read()