I create a file in a batch script on a Windows Server 2012 r2. How can I make this a UTF-8 file?
echo MyString=Hello >> myconfig.env
It creates the file but it cannot be read by other application. If I open the file in Notepad++ it says the file is UCS-2 LE BOM.
The script is running as a part of a self-hosted Github action-runner, and I think it runs under Windows PowerShell.
I have tried to set the code page by using the following before the echo-script:
chcp 65001
and
chcp 1252
but none of these seem to make any difference.
I added Write-Output $PSVersionTable
and got this:
Name Value
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.19170
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2