RedGreenBlue09 / WFAv7_Installer

Batch script to install Windows 10 ARM desktop version to Lumia devices (dual boot & single boot).
Microsoft Reciprocal License
86 stars 14 forks source link

Default character encoding can result in unreadable logs. #44

Open RedGreenBlue09 opened 4 months ago

RedGreenBlue09 commented 4 months ago

Currently, Installer uses the default system codepage. This is not a problem for CMD, as the output redirection doesn't take into account the encoding (it just writes raw bytes). However, Powershell is a different story as it usually does some processing on the I/O which alters the raw data.

This can be tested by creating Unicode.txt containing some Unicode characters, then cat Unicode.txt > Unicode2.txt. Seems like Unicode2.txt is UTF-16 LE BOM, but the Unicode characters are broken.

Solution: Set Powershell encoding to UTF8 by changing $PSDefaultParameterValues and $OutputEncoding. This solves output redirection from Powershell, but the output passed to CMD.exe is still changed, so %Logger% will not output correctly. There are 2 potential ways to fix this: