Created
January 10, 2022 21:39
-
-
Save royashbrook/9b0efe788049a24920f3ef41cab318f6 to your computer and use it in GitHub Desktop.
Simple PS script to get encoding on a file using streamreader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-FileEncoding ($FilePath){ | |
New-Object System.IO.StreamReader $FilePath -OutVariable Stream | | |
Select-Object -ExpandProperty CurrentEncoding | | |
Select-Object -ExpandProperty BodyName | |
$Stream.Dispose() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment