Skip to content

Force powershell/pwsh input/output encoding to UTF-8

Arran Walker requested to merge ajwalker/powershell-utf8-encoding into main

What does this MR do?

Forces powershell/pwsh input and output encoding to UTF-8 for scripts passed by stdin, regardless of system configuration.

Why was this MR needed?

Our scripts are passed as UTF-8 encoded. Whilst Powershell Core is documented as being UTF-8 by default, this isn't true when scripts as passed by stdin. There, the system configured encoding is used.

What's the best way to test this MR?

An integration test has been added which when when run against the codebase without this fix should fail.

We've had 2 confirmations this works from customers that were experiencing two different UTF-8 encoding problems: !3662 (comment 1167114733)

What are the relevant issue numbers?

Closes #29160 (closed)

Edited by Arran Walker

Merge request reports

Loading