abbypan
abbypan

Reputation: 158

does powershell has some function like binmode in perl?

call a script in powershell, and the script's console log is with utf-8 encoding.

what to auto encode stdout into cp936 encoding.

just like this in perl :

binmode STDOUT, ":cp936";

Upvotes: 2

Views: 161

Answers (1)

Arluin
Arluin

Reputation: 594

You can use the [System.Text.Encoding]::Convert(utf-8,gb2312,$stringtoconvert) See http://msdn.microsoft.com/en-us/library/system.text.encoding(v=vs.110).aspx for the table of supported encodings.

Upvotes: 0

Related Questions