Powershell: Setting Encoding for Get-Content Pipeline

encoding, powershell

Solution

As suggested here:

Get-Content tmp.log | Out-File -Encoding UTF8 new.log

Problem

I have a file saved as UCS-2 Little Endian I want to change the encoding so I ran the following code: ``` cat tmp.log -encoding UTF8 > new.log ``` The resulting file is still in UCS-2 Little Endian. Is this because the pipeline is always in that format? Is there an easy way to pipe this to a new file as UTF8?

Original source

Related problems