Skip to content

Keep non-ASCII characters in config output - #1542

Open
hdimer wants to merge 1 commit into
containers:mainfrom
hdimer:config-keep-non-ascii
Open

Keep non-ASCII characters in config output#1542
hdimer wants to merge 1 commit into
containers:mainfrom
hdimer:config-keep-non-ascii

Conversation

@hdimer

@hdimer hdimer commented Aug 16, 2026

Copy link
Copy Markdown

Fixes #1536.

podman-compose config renders any non-ASCII character in a compose value as a \xE9-style escape:

services:
  sample:
    image: nopush/podman-compose-test
    volumes:
    - /home/développement:/home/dev
$ podman-compose -f docker-compose.yaml config
services:
  sample:
    image: nopush/podman-compose-test
    volumes:
    - "/home/d\xE9veloppement:/home/dev"

The cause is yaml.safe_dump, which defaults to allow_unicode=False. Docker Compose prints
these characters literally. To be clear about the impact: the escaped form is valid YAML and
still parses back to the correct path, so this is a rendering/parity problem, not data loss.

I deliberately left the neighbouring json.dumps alone. It feeds self.yaml_hash, and changing
its encoding would change the hash used to decide whether containers need recreating.

One trade-off worth naming: the print in compose_config can now raise UnicodeEncodeError
if stdout is not UTF-8 capable, where before it silently emitted escapes. Docker Compose behaves
the same way and compose files are already read as UTF-8, so I left it alone, but I'm happy to
add handling if you'd rather.

Tests: a unit test covering the merged YAML, plus an exact-output integration test in
tests/integration/command_config/ alongside the existing config cases.

Written with AI assistance; reviewed and tested locally before submitting.

`yaml.safe_dump` defaults to `allow_unicode=False`, so any non-ASCII
character in a compose value was rendered as a `\xE9`-style escape in
the output of `podman-compose config`. Docker Compose prints these
characters literally.

Fixes containers#1536

Signed-off-by: Haim Dimer <haim@dimer.org>
@hdimer
hdimer marked this pull request as ready for review August 16, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The "podman compose config" command alters paths with accented characters

1 participant