I've been looking around the web for the past week to solve this issue, but I'm almost sure now that there is no solution, so this is a good challenge for many of you I guess :)
In a prod environment we are using powershell scripts to automate some processes of configuration and maintenance. These scripts always worked, until the new versions of the command line application (the scripts work with a CLI version of a bigger application), started outputting the XML results as UTF8.
This broke every script that was using this functionality.
The problem is that now there is a space, or null byte (sorry but I'm not very confident on this topic) between every single character, when redirecting output of this application to a text/log file.
I've already tried all the solutions already provided to many similar questions internet-wide, setting encoding to ascii, unicode, utfXX, OEM with the use of Set-Content, Out-File and all this sort of workarounds (even Out-String): the file is always containing these weird spaces, even two spaces when using some specific encodings.
Environment details:
> chcp
Active code page: 437
> $outputencoding
IsSingleByte : True
BodyName : us-ascii
EncodingName : US-ASCII
HeaderName : us-ascii
WebName : us-ascii
WindowsCodePage : 1252
IsBrowserDisplay : False
IsBrowserSave : False
IsMailNewsDisplay : True
IsMailNewsSave : True
EncoderFallback : System.Text.EncoderReplacementFallback
DecoderFallback : System.Text.DecoderReplacementFallback
IsReadOnly : True
CodePage : 20127
I'd really appreciate any help, suggestion, or even just some moral support