11

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

1 Answer 1

14
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

Sign up to request clarification or add additional context in comments.

7 Comments

@jeff try ISO-8859-1 for that
ut-File : Cannot validate argument on parameter 'Encoding'. The argument "ISO-8859-1" does not belong to the set unknown,string,unicode,bigendianunicode,utf8,utf7,utf32,ascii,default,oem" specified by the ValidateSet attribute.
@Jeff try utf-8-sig this one . i am learning about them . i have searched and saw this more useful link stackoverflow.com/questions/8898294/…
I don't think it is supported by powershell.
@Jeff then try in python write a python code that converts.use std.in and std.out for this save the result in txt file.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.