System.IO.File.ReadAllText method and Default encoding with Nano server
You may find that running the following command on Nano will fail
[System.IO.File]::ReadAllText($path, [System.Text.Encoding]::Default)
Exception calling "ReadAllText" with "2" argument(s): "Value cannot be null.
This is because the Default encoding is not longer in the list of valid encoding types
To resolve this issue either call ReadAllText with no parameter, or a different encoding parameter. Or better still use the Get-Content cmdlet which takes the pain away from this encoding.
[System.IO.File]::ReadAllText($path, [System.Text.Encoding]::Default)
Exception calling "ReadAllText" with "2" argument(s): "Value cannot be null.
This is because the Default encoding is not longer in the list of valid encoding types
To resolve this issue either call ReadAllText with no parameter, or a different encoding parameter. Or better still use the Get-Content cmdlet which takes the pain away from this encoding.
Comments
Post a Comment