Skip to content

Commit 473ae47

Browse files
authored
Fix different behavior for jupyter vs. terminal
When run code in non-English system, jupyter would implicitly set encoding to 'utf-8', explicitly set the encoding here would make the behavior consistent.
1 parent 0c25ec4 commit 473ae47

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cmdstanpy/utils/command.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import subprocess
66
import sys
7+
import locale
78
from typing import Callable, List, Optional, TextIO
89

910
from .filesystem import pushd
@@ -47,6 +48,7 @@ def do_command(
4748
stderr=subprocess.STDOUT, # avoid buffer overflow
4849
env=os.environ,
4950
universal_newlines=True,
51+
encoding=locale.getencoding(),
5052
)
5153
while proc.poll() is None:
5254
if proc.stdout is not None:

0 commit comments

Comments
 (0)