Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell '>' operator, change encoding?

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
like image 237
Jeff Avatar asked Jul 16 '14 02:07

Jeff


People also ask

What does %% mean in PowerShell?

% is an alias for the ForEach-Object cmdlet. An alias is just another name by which you can reference a cmdlet or function.

What is the default encoding for PowerShell?

In Windows PowerShell, the default encoding is usually Windows-1252, an extension of latin-1, also known as ISO 8859-1.


1 Answers

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

like image 84
sundar nataraj Avatar answered Sep 28 '22 16:09

sundar nataraj