Skip to content

az containerapp exec crashes on Unicode emoji output (cp1252 encoding) #33149

@achandmsft

Description

@achandmsft

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions