Azure / Azure/azure-cli

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

Open
#33,149 5 comments 0 reactions 0 assignees View on GitHub
act-observability-squad Auto-Assign ContainerApp Output Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

## Description

`az containerapp exec` crashes with `UnicodeEncodeError` when the container's stdout contains non-ASCII characters (e.g., emoji like the lobster emoji).

## Repro

```bash
# Any container that prints emoji in its output
az containerapp exec --name --resource-group --command "openclaw --version"
```

## Error

```
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f99e' in position 12: character maps to
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.