From be8189976f063ce2eef135d7457cb68fd940f4d3 Mon Sep 17 00:00:00 2001 From: JunHyeok Lee Date: Thu, 20 Aug 2026 10:01:23 +0900 Subject: [PATCH 1/2] Fix: force UTF-8 stdio mode in Windows az launcher scripts python -I isolated mode ignores PYTHONUTF8/PYTHONIOENCODING, so non-ASCII output (e.g. Korean, Chinese) gets mangled on Windows when the console's ANSI codepage isn't UTF-8. Adding -X utf8 forces PEP 540 UTF-8 mode for stdio without weakening isolation (-I still ignores PYTHONPATH, site-packages, and script-dir sys.path insertion). Fixes #28497 --- build_scripts/windows/scripts/az_msi.cmd | 2 +- build_scripts/windows/scripts/az_zip.cmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build_scripts/windows/scripts/az_msi.cmd b/build_scripts/windows/scripts/az_msi.cmd index 9e9708908c6..d11d1ea6f25 100644 --- a/build_scripts/windows/scripts/az_msi.cmd +++ b/build_scripts/windows/scripts/az_msi.cmd @@ -5,7 +5,7 @@ @IF EXIST "%~dp0\..\python.exe" ( SET AZ_INSTALLER=MSI - "%~dp0\..\python.exe" -IBm azure.cli %* + "%~dp0\..\python.exe" -X utf8 -IBm azure.cli %* ) ELSE ( echo Failed to load python executable. exit /b 1 diff --git a/build_scripts/windows/scripts/az_zip.cmd b/build_scripts/windows/scripts/az_zip.cmd index 07e4acb73ff..43417e70fbc 100644 --- a/build_scripts/windows/scripts/az_zip.cmd +++ b/build_scripts/windows/scripts/az_zip.cmd @@ -5,7 +5,7 @@ @IF EXIST "%~dp0\..\python.exe" ( SET AZ_INSTALLER=ZIP - "%~dp0\..\python.exe" -IBm azure.cli %* + "%~dp0\..\python.exe" -X utf8 -IBm azure.cli %* ) ELSE ( echo Failed to load python executable. exit /b 1 From 5ebb85e77cf0b0b7b2faebe898c74f507b1990bc Mon Sep 17 00:00:00 2001 From: JunHyeok Lee Date: Thu, 20 Aug 2026 10:07:43 +0900 Subject: [PATCH 2/2] Apply the same -X utf8 fix to the az and azps.ps1 entrypoints Both invoke the bundled python.exe with -IBm as well, so they hit the same non-ASCII output corruption as the .cmd launchers. --- build_scripts/windows/scripts/az | 2 +- build_scripts/windows/scripts/azps.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build_scripts/windows/scripts/az b/build_scripts/windows/scripts/az index 6600548847e..7ca43dac385 100644 --- a/build_scripts/windows/scripts/az +++ b/build_scripts/windows/scripts/az @@ -1,3 +1,3 @@ #!/usr/bin/env bash -AZ_INSTALLER=MSI "$(dirname "${BASH_SOURCE[0]}")/../python.exe" -IBm azure.cli "$@" +AZ_INSTALLER=MSI "$(dirname "${BASH_SOURCE[0]}")/../python.exe" -X utf8 -IBm azure.cli "$@" diff --git a/build_scripts/windows/scripts/azps.ps1 b/build_scripts/windows/scripts/azps.ps1 index 7e644639bf6..11e18c905f0 100644 --- a/build_scripts/windows/scripts/azps.ps1 +++ b/build_scripts/windows/scripts/azps.ps1 @@ -1,5 +1,5 @@ $env:AZ_INSTALLER="MSI" -& "$PSScriptRoot\..\python.exe" -IBm azure.cli $args +& "$PSScriptRoot\..\python.exe" -X utf8 -IBm azure.cli $args # SIG # Begin signature block # MIInuQYJKoZIhvcNAQcCoIInqjCCJ6YCAQExDzANBglghkgBZQMEAgEFADB5Bgor