Skip to content

[v2] Fix non-ASCII escaping in cloudformation package#10380

Open
Zelys-DFKH wants to merge 1 commit into
aws:developfrom
Zelys-DFKH:fix/10185-yaml-non-ascii-escaping
Open

[v2] Fix non-ASCII escaping in cloudformation package#10380
Zelys-DFKH wants to merge 1 commit into
aws:developfrom
Zelys-DFKH:fix/10185-yaml-non-ascii-escaping

Conversation

@Zelys-DFKH
Copy link
Copy Markdown

cloudformation package started writing emoji and other non-ASCII characters as raw UTF-8 bytes in output templates in v2.34.13, when yamlhelper.py switched from ruamel.yaml to PyYAML (PR #10164). PyYAML defaults to allow_unicode=True, which writes characters like 🚨 directly rather than as YAML unicode escapes like \U0001F6A8. CloudFormation displays these raw bytes as ? in the console and in get-template output.

The fix is allow_unicode=False on the yaml.dump() call. This restores the pre-regression behavior with no other changes to serialization.

The regression test verifies that emoji characters are serialized as YAML escape sequences rather than raw bytes, and that the escaped output round-trips correctly through yaml_parse.

Fixes #10185

Credit: @rkamach-smtc for the reproduction steps in #10185, and @RyanFitzSimmonsAK for confirming the regression on EC2.

This change was generated with AI assistance and reviewed by me.

PyYAML defaults to allow_unicode=True, which writes emoji and other
non-ASCII characters as raw UTF-8 bytes. CloudFormation displays
these as '?' in the console and get-template output.

Fixes aws#10185
@Zelys-DFKH Zelys-DFKH requested a review from a team as a code owner June 4, 2026 16:49
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.

cloudformation package stops escaping non-ASCII/emoji characters in YAML double-quoted strings starting from 2.34.13`

1 participant