Skip to content

Commit e8af4fe

Browse files
Set PYTHONUTF8=1 in generated Windows env files (#3)
Adds PYTHONUTF8=1 to env.ps1 (Windows only) and env.bat so that Python defaults to UTF-8 encoding in managed-python sessions. Co-authored-by: Oliver C <178891725+oliver-cieliszak-natterbox@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1996936 commit e8af4fe

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ def _write_env_ps1(prefix: Path, uv_env: str, python_env: str, distro_version: s
202202
"# Env vars (always set -- these are the reliable contract)",
203203
f'$env:{uv_env} = "{uv_exe}"',
204204
f'$env:{python_env} = "{venv_py}"',
205-
"",
206205
]
206+
if _IS_WINDOWS:
207+
lines.append('$env:PYTHONUTF8 = "1"')
208+
lines.append("")
207209

208210
if add_to_path:
209211
lines += [f"# {n}" for n in notes]
@@ -240,6 +242,7 @@ def _write_env_bat(prefix: Path, uv_env: str, python_env: str, distro_version: s
240242
":: Env vars (always set -- these are the reliable contract)",
241243
f'SET {uv_env}={uv_exe}',
242244
f'SET {python_env}={venv_py}',
245+
'SET PYTHONUTF8=1',
243246
"",
244247
]
245248

0 commit comments

Comments
 (0)