Skip to content

Read config and unattend files as UTF-8 - #812

Open
sean0407 wants to merge 1 commit into
google:masterfrom
sean0407:codex/glazier-799-utf8-config-reads
Open

sean0407 wants to merge 1 commit into
google:masterfrom
sean0407:codex/glazier-799-utf8-config-reads

Conversation

@sean0407

Copy link
Copy Markdown

Issue

Fixes #799.

Reproduction

With the default text encoding simulated as cp1252, reading UTF-8 YAML containing café returns café. Reading an unattend.xml containing a valid UTF-8 combining acute accent raises UnicodeDecodeError because byte 0x81 is undefined in cp1252.

Changes

  • Read configuration YAML explicitly as UTF-8.
  • Read and write unattend.xml explicitly as UTF-8.
  • Add regression coverage for both paths with cp1252 simulated as the default encoding.

Verification

In an isolated Python 3.13.16 Docker container with networking disabled and read-only source mounts:

  • python -m glazier.lib.actions.sysprep_test — 4 tests passed.
  • python -m glazier.lib.config.files_test — 5 tests passed.
  • The new regression tests failed against the unmodified source with the reported mojibake and UnicodeDecodeError, then passed with this change.
  • git diff HEAD^ HEAD --check passed.
  • Patch policy accepted 3 text files, 43 changed lines, and no binary changes.

This branch has not been deployed

No deployments
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.

Config and unattend.xml are read without an encoding, corrupting or crashing on non-ASCII outside a UTF-8 locale

1 participant