Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default character encoding can result in unreadable logs. #44

Open
RedGreenBlue09 opened this issue Jul 1, 2024 · 0 comments
Open

Default character encoding can result in unreadable logs. #44

RedGreenBlue09 opened this issue Jul 1, 2024 · 0 comments
Labels
Bug Something isn't working

Comments

@RedGreenBlue09
Copy link
Owner

RedGreenBlue09 commented Jul 1, 2024

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:

  • Use chcp 65001 but this changes the perfectly compatible font to raster font when Powershell is launched. There is no known way to work around this bug.
  • Create another logger for Powershell which uses Powershell's output redirection. However, this creates a file with 2 encodings (Default OEM codepage & UTF-8).
@RedGreenBlue09 RedGreenBlue09 added the Bug Something isn't working label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant