Keep non-ASCII characters in config output - #1542
Open
hdimer wants to merge 1 commit into
Open
Conversation
`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
marked this pull request as ready for review
August 16, 2026 12:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1536.
podman-compose configrenders any non-ASCII character in a compose value as a\xE9-style escape:The cause is
yaml.safe_dump, which defaults toallow_unicode=False. Docker Compose printsthese 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.dumpsalone. It feedsself.yaml_hash, and changingits encoding would change the hash used to decide whether containers need recreating.
One trade-off worth naming: the
printincompose_configcan now raiseUnicodeEncodeErrorif 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 existingconfigcases.Written with AI assistance; reviewed and tested locally before submitting.