Azure DevOps PR titles render as U+FFFD on Windows because az writes ANSI bytes#25488
What happened
In the Pull Requests screen for an Azure DevOps repository, every non-ASCII character in PR titles, descriptions and thread comments renders as � (U+FFFD). The same PR is correct in the Azure DevOps web UI.
Screenshot (before the launcher workaround):
Diagnosis
az is a Python program; when its stdout is a pipe, it encodes text in the system ANSI code page (cp1252 for Portuguese Windows, cp1250/1251/etc. elsewhere). T3 decodes every child process's stdout as UTF-8 and replaces invalid sequences with � (apps/server/src/processRunner.ts → decodeUtf8 in packages/provider-core/src/server/collectStreamText.ts). That helper already computes invalidUtf8, but nothing re-decodes with it. The Azure DevOps provider reads PR text only through az repos pr show, az repos pr list and az devops invoke, so all Azure PR text is affected on Windows. PYTHONIOENCODING/PYTHONUTF8 do not help: az.cmd runs python -IBm azure.cli, and -I implies -E.
Steps to reproduce
- Windows with a non-UTF-8 ANSI code page (the default for most locales).
- Azure DevOps repository with a PR whose title or description contains an accented character.
- T3 Code → Pull Requests → open the PR: the text shows
�. - Without a PR:
az nao-existe-çwith stdout captured as bytes emitsE7forç; decoding those bytes as UTF-8 yields�.
Version
0.1.2 (also reproduces on 0.1.1)
Environment
Windows 11 x64, T3 desktop (Electron server), azure-cli 2.91.0, azure-devops 1.0.9, system ANSI code page 1252
Evidence
az … --output jsonemitsE7forç; UTF-8 would beC3 A7.Buffer.from(bytes).toString("utf8")→�, the exact symptom.- With the CLI interpreter forced to UTF-8 (
python.exe -X utf8 -IBm azure.cli), the same command emitsC3 A7and the title/description decode correctly — so the stored PR data is intact and only the read path is at fault.
Related issues
None found for Azure CLI output encoding.
Fix applied or workaround
Replaced the Azure CLI launcher (…\AzureCLI\…\wbin\az.cmd) with one that runs the same interpreter as python.exe -X utf8 -IBm azure.cli %*. PR text then decodes correctly.
Screenshot (after the launcher workaround):
Suggested fix
Use the existing invalidUtf8 flag — on win32, when set, decode with the ANSI code page (TextDecoder("windows-1252") covers Western European; resolve ACP for other locales) instead of substituting U+FFFD, ideally scoped to the az spawn.
Filed by
opencode (opencode-go/deepseek-v4.1-flash) via t3 triage