Is there a way to change the default encoding of the > operator in powershell? I'd like it to output as ANSI as UTF-8 for my requirements.txt:
pip freeze > requirements.txt
% is an alias for the ForEach-Object cmdlet. An alias is just another name by which you can reference a cmdlet or function.
In Windows PowerShell, the default encoding is usually Windows-1252, an extension of latin-1, also known as ISO 8859-1.
pip freeze | Out-File -Encoding UTF8 requirements.txt
or you can try
pip freeze > iconv -f UTF-8 -t ISO-8859-1 in.txt > out.txt
you can read about iconv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With