Skip to content

Commit 5ffbfa3

Browse files
authored
fix: UnicodeDecodeError on non-utf locales (#69)
1 parent ca680c6 commit 5ffbfa3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/hatch_cython/plugin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import locale
12
import os
23
import re
34
import subprocess
@@ -311,7 +312,8 @@ def build_ext(self):
311312
stderr=subprocess.STDOUT,
312313
env=self.options.envflags.env,
313314
)
314-
stdout = process.stdout.decode("utf-8")
315+
encoding = locale.getpreferredencoding()
316+
stdout = process.stdout.decode(encoding, errors="replace")
315317
if process.returncode:
316318
self.app.display_error(f"cythonize exited non null status {process.returncode}")
317319
self.app.display_error(stdout)

0 commit comments

Comments
 (0)