awslabs / aws-lambda-powershell-runtime

This new PowerShell custom runtime for AWS Lambda makes it even easier to run Lambda functions written in PowerShell to process events.
Apache License 2.0
59 stars 20 forks source link

Out-File messes up the encoding of the pwsh-runtime.psm1. #12

Closed julianwood closed 1 year ago

julianwood commented 1 year ago

Another issue that I observed is that the Out-File messes up the encoding of the pwsh-runtime.psm1. I am not sure if anyone has observed this but I tested this on two machines and it ended up making the file unreadable. Adding -Encoding UTF8 with Out-File solved the problem.

Originally posted by @swordfish291 in https://github.com/awslabs/aws-lambda-powershell-runtime/issues/11#issuecomment-1407569014

julianwood commented 1 year ago

Moving this to track separately. @swordfish291 What OS/pwsh are you running this on? What is not able to read the file? IDE, or Lambda runtime?

swordfish291 commented 1 year ago

Both. IDE shows weiredly formatted data and Lambda fails to execute.

austoonz commented 1 year ago

I have the same issue.

I've pushed an update to the build script to add -Encoding UTF8. It seems Windows PowerShell and PowerShell 7 have different defaults.

Feel free to validate before we close this...

swordfish291 commented 1 year ago

Validated. Worrking as expected in Windows PowerShell and PowerShell core.

This can be closed.