@@ -252,9 +252,11 @@ def get_diagnostics(
252
252
# mypy exists on path
253
253
# -> use mypy on path
254
254
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
258
260
exit_status = completed_process .returncode
259
261
else :
260
262
# mypy does not exist on path, but must exist in the env pylsp-mypy is installed in
@@ -275,8 +277,9 @@ def get_diagnostics(
275
277
["dmypy" , "--status-file" , dmypy_status_file , "status" ],
276
278
capture_output = True ,
277
279
** windows_flag ,
280
+ encoding = "utf-8" ,
278
281
)
279
- errors = completed_process .stderr . decode ()
282
+ errors = completed_process .stderr
280
283
exit_status = completed_process .returncode
281
284
if exit_status != 0 :
282
285
log .info (
@@ -288,6 +291,7 @@ def get_diagnostics(
288
291
["dmypy" , "--status-file" , dmypy_status_file , "restart" ],
289
292
capture_output = True ,
290
293
** windows_flag ,
294
+ encoding = "utf-8" ,
291
295
)
292
296
else :
293
297
# dmypy does not exist on path, but must exist in the env pylsp-mypy is installed in
@@ -310,10 +314,10 @@ def get_diagnostics(
310
314
# -> use mypy on path
311
315
log .info ("dmypy run args = %s via path" , args )
312
316
completed_process = subprocess .run (
313
- ["dmypy" , * args ], capture_output = True , ** windows_flag
317
+ ["dmypy" , * args ], capture_output = True , ** windows_flag , encoding = "utf-8"
314
318
)
315
- report = completed_process .stdout . decode ()
316
- errors = completed_process .stderr . decode ()
319
+ report = completed_process .stdout
320
+ errors = completed_process .stderr
317
321
exit_status = completed_process .returncode
318
322
else :
319
323
# dmypy does not exist on path, but must exist in the env pylsp-mypy is installed in
0 commit comments