Most likely the input file is ascii
encoding while the default output using redirection is unicode
encoding.
Instead of using >
as redirection you can use out-file and specify an encoding.
get-content $inputFile | sort | out-file -encoding ASCII