spectre.console
spectre.console copied to clipboard
Unable to redirect output to file
Information
- OS: [eg Windows/Linux/MacOS]
- Version: [e.g. 0.33.0]
- Terminal: [e.g Windows Terminal]
Describe the bug Trying to run the console app and redirect the output to file consoleapp.exe > dump.ansi
To Reproduce Steps to reproduce the behavior.
Expected behavior should be able to view the file in powershell using type dump.ansi -Encoding oem
Screenshots
The file is showing as
Additional context Add any other context about the problem here.
Please upvote :+1: this issue if you are interested in it.
Looks like your terminal doesn't support ansi escape codes or the encoding you've selected messes something up. I'm afraid this is outside the scope of the project.
I think I have run into the same issue.
I can reproduce encoding errors on Windows in both the old terminal (ConHost) and Windows Terminal when the shell is Windows Powershell (powershell.exe), on newer versions of Powershell (pwsh.exe) everything seems to be working fine.
I think this is related to the encoding used by Powershell.
A workaround is, setting the console encoding before running the tool that uses Spectre.Console:
[Console]::InputEncoding = [Console]::OutputEncoding = New-Object System.Text.UTF8Encoding