How to read text files using some encoding in powershell?
I am doing the following:
$text = [System.IO.File]::ReadAllLines("path.txt")
$text
But I needed to put the UTF8 encode, how can I do that?
CodePudding user response:
This should do it:
[System.IO.File]::ReadAllLines("path.txt", [System.Text.Encoding]::UTF8)