Description
az containerapp exec crashes with UnicodeEncodeError when the container's stdout contains non-ASCII characters (e.g., emoji like the lobster emoji).
Repro
# Any container that prints emoji in its output
az containerapp exec --name <app> --resource-group <rg> --command "openclaw --version"
Error
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f99e' in position 12: character maps to <undefined>
File "azure/cli/command_modules/containerapp/_ssh_utils.py", line 108, in _decode_and_output_to_terminal
File "encodings\cp1252.py", line 19, in encode
Root cause
_ssh_utils.py line 108 uses cp1252 encoding which cannot represent characters outside the Windows-1252 range. This makes exec unusable for any application that prints emoji or non-Latin characters.
Workaround
Use Azure Portal Console instead.
Expected
exec should handle Unicode output correctly (use UTF-8 or replace unencodable characters).
Environment
- Azure CLI 2.x
- Windows 11
- April 2026
Description
az containerapp execcrashes withUnicodeEncodeErrorwhen the container's stdout contains non-ASCII characters (e.g., emoji like the lobster emoji).Repro
Error
Root cause
_ssh_utils.pyline 108 usescp1252encoding which cannot represent characters outside the Windows-1252 range. This makesexecunusable for any application that prints emoji or non-Latin characters.Workaround
Use Azure Portal Console instead.
Expected
execshould handle Unicode output correctly (use UTF-8 or replace unencodable characters).Environment