@@ -252,9 +252,11 @@ def get_diagnostics(
252252 # mypy exists on path
253253 # -> use mypy on path
254254 log .info ("executing mypy args = %s on path" , args )
255- completed_process = subprocess .run (["mypy" , * args ], capture_output = True , ** windows_flag )
256- report = completed_process .stdout .decode ()
257- errors = completed_process .stderr .decode ()
255+ completed_process = subprocess .run (
256+ ["mypy" , * args ], capture_output = True , ** windows_flag , encoding = "utf-8"
257+ )
258+ report = completed_process .stdout
259+ errors = completed_process .stderr
258260 exit_status = completed_process .returncode
259261 else :
260262 # mypy does not exist on path, but must exist in the env pylsp-mypy is installed in
@@ -275,8 +277,9 @@ def get_diagnostics(
275277 ["dmypy" , "--status-file" , dmypy_status_file , "status" ],
276278 capture_output = True ,
277279 ** windows_flag ,
280+ encoding = "utf-8" ,
278281 )
279- errors = completed_process .stderr . decode ()
282+ errors = completed_process .stderr
280283 exit_status = completed_process .returncode
281284 if exit_status != 0 :
282285 log .info (
@@ -288,6 +291,7 @@ def get_diagnostics(
288291 ["dmypy" , "--status-file" , dmypy_status_file , "restart" ],
289292 capture_output = True ,
290293 ** windows_flag ,
294+ encoding = "utf-8" ,
291295 )
292296 else :
293297 # dmypy does not exist on path, but must exist in the env pylsp-mypy is installed in
@@ -310,10 +314,10 @@ def get_diagnostics(
310314 # -> use mypy on path
311315 log .info ("dmypy run args = %s via path" , args )
312316 completed_process = subprocess .run (
313- ["dmypy" , * args ], capture_output = True , ** windows_flag
317+ ["dmypy" , * args ], capture_output = True , ** windows_flag , encoding = "utf-8"
314318 )
315- report = completed_process .stdout . decode ()
316- errors = completed_process .stderr . decode ()
319+ report = completed_process .stdout
320+ errors = completed_process .stderr
317321 exit_status = completed_process .returncode
318322 else :
319323 # dmypy does not exist on path, but must exist in the env pylsp-mypy is installed in
0 commit comments